Skip to content

Commit a62fb1f

Browse files
docs(extensions): clarify agent-context README and add config examples (#3389)
* docs(extensions): clarify agent-context README and add config examples Rewrite the agent-context extension README to read as plain prose instead of a bullet dump, and add the missing install/disable commands (specify extension add/disable/enable agent-context). Add inline example comments to agent-context-config.yml for context_file/context_files. * docs(agent-context): clarify config documentation - Reformat comments to flow as single-line paragraphs instead of multi-line breaks - Add "WHAT" sections describing each configuration option's purpose - Add "REQUIREMENT" sections specifying if options are optional or required - Add explicit EXAMPLE sections for context_markers configuration - Improve clarity of context_file and context_files option descriptions * docs(agent-context): fix GitHub casing, clarify config - Fix "Github" -> "GitHub" casing in README issues link - Clarify agent-context-config.yml comments on context_file/context_files behavior and precedence * YAML indentation fix for context markers Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * docs(agent-context): simplify README config section - Clarify config file path reference (.specify/extensions path vs repo path) - Remove duplicated YAML example/field docs from README, point to config file directly - Minor spacing fix in agent-context-config.yml comment * docs(agent-context): clarify config file path in README - Reference the installed .specify config path alongside the repo-relative link * docs(agent-context): clarify install and marker requirement - README: clarify install command must be run from an initialized Spec Kit project root - config: correct context_markers requirement from REQUIRED to OPTIONAL * Wording Fix Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * docs(agent-context): clarify context_file path rules - Document that context_file/context_files are relative to the project root (directory containing .specify/) - State the rejected path forms (absolute paths, backslash separators, .. segments) directly in each field's WHAT comment * Updated supported invocation syntaxes Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Extension Disable Clarification Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * docs(agent-context): document .mdc frontmatter exception - Clarify that .mdc files get alwaysApply: true set in frontmatter, outside the managed marker block - Fix "Everything else is untouched" wording so it doesn't contradict the exception right above it --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent a5b6ce4 commit a62fb1f

2 files changed

Lines changed: 46 additions & 46 deletions

File tree

extensions/agent-context/README.md

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,62 @@
22

33
This bundled extension manages the **coding agent context/instruction file** (e.g. `CLAUDE.md`, `.github/copilot-instructions.md`, `AGENTS.md`, `GEMINI.md`, …) for the active integration.
44

5-
It owns the lifecycle of the managed section delimited by the configurable start/end markers (defaults: `<!-- SPECKIT START -->` / `<!-- SPECKIT END -->`).
5+
It owns the lifecycle of the managed section delimited by the configurable start/end markers (defaults: `<!-- SPECKIT START -->` / `<!-- SPECKIT END -->`). For `.mdc` files, it also ensures the YAML frontmatter (the metadata block at the top of the file) contains `alwaysApply: true`. Otherwise, everything outside the managed section is untouched.
6+
7+
> NOTE: Spec Kit itself never touches your agent context file. This extension is the only thing that does, and it's opt-in: install it if you want the block kept in sync, skip it if you'd rather manage that file yourself.
68
79
## Why an extension?
810

911
Not every Spec Kit user wants Spec Kit to write into the coding agent's context file. Keeping this behavior in a dedicated, **opt-in** extension lets users:
1012

11-
- **Choose whether to install it at all** `specify init` does not install it. Add it explicitly when you want Spec Kit to manage the agent context file; if it is absent or disabled, Spec Kit never creates or modifies that file.
12-
- **Customize the markers** by editing `.specify/extensions/agent-context/agent-context-config.yml` the bundled scripts honor the `context_markers` value.
13+
- **Choose whether to install it at all** - `specify init` does **not** install it. Add it explicitly when you want Spec Kit to manage the agent context file; when it is absent, the file is never modified, and when it is disabled, its automatic hooks do not run.
14+
- **Customize the markers** by editing `.specify/extensions/agent-context/agent-context-config.yml` ([agent-context-config.yml](./agent-context-config.yml) in this repo) - the bundled scripts honor the `context_markers` value.
1315
- **Synchronize multiple agent anchors** by setting `context_files` when a project intentionally uses more than one coding agent context file, such as `AGENTS.md` and `CLAUDE.md`.
14-
- **Refresh on demand** by running the `speckit.agent-context.update` command in your agent, or automatically through the hooks declared in `extension.yml` (`after_specify`, `after_plan`). Invoke it using your agent's slash-command separator — `/speckit.agent-context.update` for dot-separator agents or `/speckit-agent-context-update` for hyphen-separator agents (e.g. Forge, Cline).
16+
- **Refresh on demand** by running the `speckit.agent-context.update` command in your agent, or automatically through the hooks declared in [extension.yml](./extension.yml) (`after_specify`, `after_plan`).
1517

16-
## Commands
18+
## Installation
1719

18-
The command ID below is canonical. When invoking it as a slash command, use your agent's separator: `/speckit.agent-context.update` for dot-separator agents or `/speckit-agent-context-update` for hyphen-separator agents (e.g. Forge, Cline).
20+
To install the extension, from the root of an initialized Spec Kit project, run:
1921

20-
| Command | Description |
21-
|---------|-------------|
22-
| `speckit.agent-context.update` | Refresh the managed section in the agent context file with the current plan path. |
22+
```bash
23+
specify extension add agent-context
24+
```
2325

24-
## Configuration
26+
## Disabling
2527

26-
All configuration flows through the extension's own config file at
27-
`.specify/extensions/agent-context/agent-context-config.yml`:
28+
```bash
29+
specify extension disable agent-context
2830

29-
```yaml
30-
# Path to the coding agent context file managed by this extension
31-
context_file: CLAUDE.md
31+
# Re-enable it
32+
specify extension enable agent-context
33+
```
3234

33-
# Optional list of coding agent context files to manage together.
34-
# When non-empty, this takes precedence over context_file.
35-
context_files:
36-
- AGENTS.md
37-
- CLAUDE.md
35+
While this extension is disabled (or not installed), nothing in Spec Kit creates, updates, or removes the managed block - the `__CONTEXT_FILE__` placeholder in any template is left as-is, and the extension's own config is never read.
3836

39-
# Delimiters for the managed Spec Kit section
40-
context_markers:
41-
start: "<!-- SPECKIT START -->"
42-
end: "<!-- SPECKIT END -->"
43-
```
37+
## Commands
38+
39+
| Command | Description |
40+
| ------------------------------ | --------------------------------------------------------------------------------- |
41+
| `speckit.agent-context.update` | Refresh the managed section in the agent context file with the current plan path. |
42+
43+
> NOTE: The command ID above is canonical. Invoke it using the syntax for your integration: `/speckit.agent-context.update` for dot-command integrations; `/speckit-agent-context-update` for hyphen/skills integrations (including Forge and Cline); `$speckit-agent-context-update` for Codex or ZCode in skills mode; or `/skill:speckit-agent-context-update` for Kimi.
44+
45+
## Configuration
4446

45-
- `context_file` — the project-relative path to the coding agent context file. When empty, the bundled update scripts self-seed it by looking up the active integration's key in this extension's own `agent-context-defaults.json` map. The Specify CLI is never consulted.
46-
- `context_files` — optional project-relative paths to multiple coding agent context files. When non-empty, the list takes precedence over `context_file`. Absolute paths, backslash separators, and `..` path segments are rejected.
47-
- `context_markers.start` / `.end` — the delimiters around the managed section. Edit these to use custom markers.
47+
All configuration flows through the extension's own config file at `.specify/extensions/agent-context/agent-context-config.yml` ([agent-context-config.yml](./agent-context-config.yml) in the repo).
4848

4949
## Requirements
5050

5151
The bundled update scripts require **Python 3** with **PyYAML** for YAML/upsert processing (PowerShell can also use `ConvertFrom-Yaml` when available).
5252

53-
PyYAML ships with the `specify` CLI and is normally available via the same `python3` interpreter. If a hook reports *"PyYAML is required … not available in the current Python environment"*, it means the system `python3` differs from the one used to install Spec Kit. To resolve, run:
53+
PyYAML ships with the `specify` CLI and is normally available via the same `python3` interpreter. If a hook reports _"PyYAML is required … not available in the current Python environment"_, it means the system `python3` differs from the one used to install Spec Kit. To resolve, run:
5454

5555
```bash
5656
pip install pyyaml
5757
# or target the specific interpreter Spec Kit uses:
5858
/path/to/speckit-python -m pip install pyyaml
5959
```
6060

61-
## Disable
62-
63-
```bash
64-
specify extension disable agent-context
65-
```
61+
## Issues
6662

67-
When disabled (or never installed), Spec Kit performs no agent context file creation, updates, or removal — the extension's bundled scripts are the only code that ever touches the managed section. The Specify CLI carries no agent-context state at all: it never reads this config, never resolves a context file, and the `__CONTEXT_FILE__` placeholder (if present in any template) is left untouched. All context-file knowledge — including the per-agent default mapping in `agent-context-defaults.json` — lives entirely within this extension, so disabling it is a complete opt-out.
63+
For any other issues, please create an issue in the [official GitHub repo](https://github.com/github/spec-kit/issues).
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Coding Agent Context Extension Configuration
2-
# These values are populated automatically by `specify init` and
3-
# `specify integration use` / `specify integration install`.
42

5-
# Path (relative to the project root) to the default coding agent context file
6-
# managed by this extension (e.g. CLAUDE.md, AGENTS.md,
7-
# .github/copilot-instructions.md). Set automatically from the active
8-
# integration and regenerated during `specify init` or integration switches.
3+
# WHAT: The single agent context file relative to the project root (the directory containing .specify/). Absolute paths, backslash separators, and `..` path segments are rejected.
4+
# REQUIREMENT: OPTIONAL. Use this if you want to manually specify a single context file. If you leave this entry blank, it will use the default context file for the coding agent you picked when you set up Spec Kit. See `agent-context-defaults.json` for the defaults.
5+
# EXAMPLE: context_file: CLAUDE.md
96
context_file: ""
107

11-
# Optional list of project-relative coding agent context files managed by this
12-
# extension. When non-empty, this list takes precedence over `context_file`.
13-
# Use this for projects that intentionally keep multiple agent anchors in sync.
8+
# WHAT: List of agent context files relative to the project root (the directory containing .specify/). If you have both `context_file` and `context_files` filled, then this (`context_files`) takes precedence. Absolute paths, backslash separators, and `..` path segments are rejected.
9+
# REQUIREMENT: OPTIONAL. Use this if your project requires you to keep multiple agent context files in sync.
10+
# EXAMPLE:
11+
# context_files:
12+
# - AGENTS.md
13+
# - CLAUDE.md
1414
context_files: []
1515

16-
# Delimiters for the managed Spec Kit section.
17-
# Edit these to use custom markers.
16+
# WHAT: Markers (delimiters) for the managed Spec Kit section. This extension injects information only between these markers.
17+
# REQUIREMENT: OPTIONAL. Only change if you wish to have a custom marker name.
18+
# EXAMPLE:
19+
# context_markers:
20+
# start: "<!-- AGENT SPEC KIT CONTEXT START -->"
21+
# end: "<!-- AGENT SPEC KIT CONTEXT END -->"
1822
context_markers:
1923
start: "<!-- SPECKIT START -->"
2024
end: "<!-- SPECKIT END -->"

0 commit comments

Comments
 (0)