You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The name of a task file to look up in task search paths (.agents/tasks).
88
+
Task files are matched by filename (without .md extension).
89
+
90
+
[user-prompt] (optional)
91
+
Optional text to append to the task. It can contain slash commands
92
+
(e.g., '/command-name') which will be expanded, and parameter
93
+
substitution (${param}).
84
94
85
95
Options:
86
96
-C string
@@ -96,7 +106,7 @@ Options:
96
106
Include rules with matching frontmatter. Can be specified multiple times as key=value.
97
107
Note: Only matches top-level YAML fields in frontmatter.
98
108
-a string
99
-
Default agent to use if task doesn't specify one. Excludes that agent's own rule paths (since the agent reads those itself). Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex.
109
+
Target agent to use (excludes rules from that agent's own paths). Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex.
100
110
-w Write rules to agent's config file and output only task to stdout. Requires agent (via task or -a flag).
101
111
```
102
112
@@ -179,22 +189,22 @@ Each of these would have a corresponding `.md` file (e.g., `triage-bug.md`, `fix
179
189
180
190
The tool assembles the context in the following order:
181
191
182
-
1.**Rule Files**: It searches a list of predefined locations for rule files (`.md` or `.mdc`). These locations include the current directory, ancestor directories, user's home directory, and system-wide directories.
192
+
1.**Rule Files**: It searches for rule files (`.md` or `.mdc`) in directories specified via `-d` flags and automatically-added working directory and home directory.
183
193
2.**Rule Bootstrap Scripts**: For each rule file found (e.g., `my-rule.md`), it looks for an executable script named `my-rule-bootstrap`. If found, it runs the script before processing the rule file. These scripts are meant for bootstrapping the environment (e.g., installing tools) and their output is sent to `stderr`, not into the main context.
184
194
3.**Filtering**: If `-s` (include) flag is used, it parses the YAML frontmatter of each rule file to decide whether to include it. Note that selectors can only match top-level YAML fields (e.g., `language: go`), not nested fields.
185
195
4.**Task Prompt**: It searches for a task file matching the filename (without `.md` extension). Tasks are matched by filename, not by `task_name` in frontmatter. If selectors are provided with `-s`, they are used to filter between multiple task files with the same filename.
186
196
5.**Task Bootstrap Script**: For the task file found (e.g., `fix-bug.md`), it looks for an executable script named `fix-bug-bootstrap`. If found, it runs the script before processing the task file. This allows task-specific environment setup or data preparation.
187
-
6.**Parameter Expansion**: It substitutes variables in the task prompt using the `-p` flags.
188
-
7.**Output**: It prints the content of all included rule files, followed by the expanded task prompt, to standard output.
189
-
8.**Token Count**: A running total of estimated tokens is printed to standard error.
197
+
6.**User Prompt Appending**: If a user-prompt argument is provided, it is appended to the task content after a delimiter (`---`).
198
+
7.**Parameter Expansion**: It substitutes variables in the task prompt and user-prompt using the `-p` flags.
199
+
8.**Output**: It prints the content of all included rule files, followed by the expanded task prompt, to standard output.
200
+
9.**Token Count**: A running total of estimated tokens is printed to standard error.
190
201
191
202
### File Search Paths
192
203
193
204
The tool looks for task and rule files in the following locations, in order of precedence:
194
205
195
206
**Tasks:**
196
207
-`./.agents/tasks/*.md` (task name matches filename without `.md` extension)
197
-
-`~/.agents/tasks/*.md`
198
208
199
209
**Commands** (reusable content blocks referenced via slash commands like `/command-name` inside task content):
200
210
-`./.agents/commands/*.md`
@@ -204,9 +214,9 @@ The tool looks for task and rule files in the following locations, in order of p
204
214
**Rules:**
205
215
The tool searches for a variety of files and directories, including:
@@ -503,42 +507,34 @@ If you need to filter on nested data, flatten your frontmatter structure to use
503
507
504
508
### Targeting a Specific Agent
505
509
506
-
When working with a specific AI coding agent, the agent itself will read its own configuration files. The `-a` flag lets you specify which agent you're using, automatically excluding that agent's specific rule paths while including rules from other agents and generic rules.
510
+
The `-a` flag specifies which AI coding agent you're using. This information is currently used for:
511
+
512
+
1. **Write Rules Mode**: With the `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for `copilot`)
513
+
514
+
> **Note:** Agent-based rule filtering is not currently implemented. All rules are included regardless of the `-a` value.
507
515
508
516
**Supported agents:**
509
-
- `cursor`- Excludes `.cursor/rules`, `.cursorrules`; includes other agents and generic rules
510
-
- `opencode`- Excludes `.opencode/agent`, `.opencode/command`; includes other agents and generic rules
511
-
- `copilot`- Excludes `.github/copilot-instructions.md`, `.github/agents`; includes other agents and generic rules
512
-
- `claude`- Excludes `.claude/`, `CLAUDE.md`, `CLAUDE.local.md`; includes other agents and generic rules
513
-
- `gemini`- Excludes `.gemini/`, `GEMINI.md`; includes other agents and generic rules
514
-
- `augment`- Excludes `.augment/`; includes other agents and generic rules
515
-
- `windsurf`- Excludes `.windsurf/`, `.windsurfrules`; includes other agents and generic rules
516
-
- `codex`- Excludes `.codex/`, `AGENTS.md`; includes other agents and generic rules
517
+
- `cursor`- Cursor IDE
518
+
- `opencode`- OpenCode.ai
519
+
- `copilot`- GitHub Copilot
520
+
- `claude`- Anthropic Claude
521
+
- `gemini`- Google Gemini
522
+
- `augment`- Augment
523
+
- `windsurf`- Windsurf
524
+
- `codex`- Codex
517
525
518
-
**Example: Using Cursor:**
526
+
**Example:**
519
527
520
528
```bash
521
-
# When using Cursor, exclude .cursor/ and .cursorrules (Cursor reads those itself)
522
-
# But include rules from other agents and generic rules
523
-
coding-context -a cursor /fix-bug
529
+
# Use with write rules mode
530
+
coding-context -a copilot -w fix-bug
524
531
```
525
532
526
533
**How it works:**
527
-
- The `-a` flag sets the target agent
528
-
- The target agent's own paths are excluded (e.g., `.cursor/` for cursor)
529
-
- Rules from other agents are included (e.g., `.opencode/`, `.github/copilot-instructions.md`)
530
-
- Generic rules (from `.agents/rules`) are always included
531
-
- The agent name is automatically added as a selector, so generic rules can filter themselves with `agent: cursor` in frontmatter
532
-
533
-
**Example generic rule with agent filtering:**
534
-
535
-
```markdown
536
-
---
537
-
agent: cursor
538
-
---
539
-
# This rule only applies when using Cursor
540
-
Use Cursor-specific features...
541
-
```
534
+
- The `-a` flag sets the target agent value
535
+
- The agent value is stored in the context for use by the `-w` flag
536
+
- With `-w`, the agent determines where to write rules to the user's home directory
537
+
- All rules are currently included regardless of agent value
542
538
543
539
**Agent field in task frontmatter:**
544
540
@@ -551,15 +547,7 @@ agent: cursor
551
547
# This task automatically sets the agent to cursor
552
548
```
553
549
554
-
This is useful for tasks designed for specific agents, ensuring the correct agent context is used regardless of command-line flags.
555
-
556
-
**Use cases:**
557
-
- **Avoid duplication**: The agent reads its own config, so exclude it from the context
558
-
- **Cross-agent rules**: Include rules from other agents that might be relevant
559
-
- **Generic rules**: Always include generic rules, with optional agent-specific filtering
560
-
- **Task-specific agents**: Tasks can enforce a specific agent context
561
-
562
-
The exclusion happens before rule processing, so excluded paths are never loaded or counted toward token estimates.
550
+
This is useful for tasks designed for specific agents, ensuring the correct agent is set for determining the write path with `-w`.
0 commit comments