|
61 | 61 | ``` |
62 | 62 |
|
63 | 63 | **system.md** - System prompt with optional template variables: |
64 | | -- `{{date}}`, `{{datetime}}`, `{{datetime_rfc3339}}`, `{{time}}`, `{{year}}`, `{{weekday}}` |
65 | | -- `{{timezone}}`, `{{timezone_abbr}}`, `{{timezone_offset}}`, `{{utc_date}}`, `{{utc_datetime}}` |
66 | | -- `{{cwd}}`, `{{cwd_name}}`, `{{home}}`, `{{user}}` |
67 | | -- `{{git_branch}}`, `{{git_repo}}`, `{{git_diff_stat}}` |
68 | | -- `{{files}}`, `{{file_count}}` (from -f flags) |
69 | | -- `{{os}}`, `{{platform}}`, `{{resource_dir}}` |
70 | | -- `{{provider}}`, `{{model}}`, `{{provider_model}}` |
71 | | -- `{{agents}}` - Loads project instructions (hierarchical AGENTS.md + fallbacks) |
72 | | - |
73 | | -**The `{{agents}}` variable** loads project instructions using: |
| 64 | +- `{{!date}}`, `{{!datetime}}`, `{{!datetime_rfc3339}}`, `{{!time}}`, `{{!year}}`, `{{!weekday}}` |
| 65 | +- `{{!timezone}}`, `{{!timezone_abbr}}`, `{{!timezone_offset}}`, `{{!utc_date}}`, `{{!utc_datetime}}` |
| 66 | +- `{{!cwd}}`, `{{!cwd_name}}`, `{{!home}}`, `{{!user}}` |
| 67 | +- `{{!git_branch}}`, `{{!git_repo}}`, `{{!git_diff_stat}}` |
| 68 | +- `{{!files}}`, `{{!file_count}}` (from -f flags) |
| 69 | +- `{{!os}}`, `{{!platform}}`, `{{!resource_dir}}` |
| 70 | +- `{{!provider}}`, `{{!model}}`, `{{!provider_model}}` |
| 71 | +- `{{!agents}}` - Loads project instructions (hierarchical AGENTS.md + fallbacks) |
| 72 | + |
| 73 | +**The `{{!agents}}` variable** loads project instructions using: |
74 | 74 | 1. User-level: `~/.config/term-llm/AGENTS.md` (always included if present) |
75 | 75 | 2. Project-level: AGENTS.md hierarchy from repo root → cwd (at each level, AGENTS.override.md takes precedence over AGENTS.md) |
76 | 76 | 3. Fallback (only if no AGENTS.md found): CLAUDE.md, .github/copilot-instructions.md, .cursor/rules, CONTRIBUTING.md |
@@ -109,7 +109,7 @@ tools: |
109 | 109 | - Use `custom` instead of `run_agent_script` when the tool has a clear name/schema the LLM should understand natively |
110 | 110 | - No directory paths are exposed to the LLM — scripts are resolved from the agent's own directory |
111 | 111 | - No permission prompts — scripts in the agent directory are implicitly trusted |
112 | | -- This replaces the old `{{agent_dir}}` shell allow pattern approach which never worked |
| 112 | +- This replaces the old `{{!agent_dir}}` shell allow pattern approach which never worked |
113 | 113 | - Scripts must be executable files (not symlinks to outside the agent directory) |
114 | 114 |
|
115 | 115 | **Additional .md files** - Include reference material: |
@@ -199,10 +199,10 @@ Structure system.md with: |
199 | 199 |
|
200 | 200 | 1. **Role** - Clear statement of what the agent does |
201 | 201 | 2. **Context** - Use template variables for dynamic info (date, repo, etc.) |
202 | | - - **Always include `Current local time: {{weekday}} {{datetime_rfc3339}} ({{timezone}}).`** at the top so the agent knows the current date and timezone |
203 | | - - Use `UTC: {{utc_datetime}}.` as well for jobs, logs, or cross-timezone coordination |
204 | | - - Add `User: {{user}}.` if user context is helpful |
205 | | - - Add `Working in: {{cwd_name}}` or `Repository: {{git_repo}}` for project-aware agents |
| 202 | + - **Always include `Current local date: {{!weekday}} {{!date}} ({{!timezone}}).`** at the top so the agent knows the current local date without changing every minute and breaking prompt caches |
| 203 | + - Add `{{!time}}`, `{{!datetime_rfc3339}}`, or `UTC: {{!utc_datetime}}.` only for agents that genuinely need time-of-day precision, logs, jobs, or cross-timezone coordination |
| 204 | + - Add `User: {{!user}}.` if user context is helpful |
| 205 | + - Add `Working in: {{!cwd_name}}` or `Repository: {{!git_repo}}` for project-aware agents |
206 | 206 | 3. **Process** - Step-by-step workflow the agent should follow |
207 | 207 | 4. **Guidelines** - Best practices and constraints |
208 | 208 | 5. **Output format** - How to structure responses (if relevant) |
|
0 commit comments