Skip to content

Commit 55efd19

Browse files
committed
docs: add agents md config proposal
1 parent dab5d93 commit 55efd19

File tree

5 files changed

+178
-5
lines changed

5 files changed

+178
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
# OpenSpec
2929

30-
**Supported AI Tools:** ✅ Claude Code | ✅ Cursor | ✅ AGENTS.md instructions
30+
**Supported AI Tools:** ✅ Claude Code (custom slash commands) | ✅ Cursor (custom slash commands)
31+
32+
Any assistant that understands the [AGENTS.md](https://agents.md/) convention—such as Codex, Amp, Jules, OpenCode, Gemini CLI, or GitHub Copilot—can consume the OpenSpec instructions, though without the slash-command shortcuts.
3133

3234
**Custom Slash Commands:** Jump straight into any workflow step with the optional `/openspec` commands—no prompt engineering required:
3335

@@ -279,12 +281,23 @@ Without specs, AI coding assistants generate code based on vague prompts, often
279281
**Tool Freedom:** Your team can use different AI assistants. One developer might use Claude Code while another uses Cursor - OpenSpec keeps everyone aligned through shared specifications. Run `openspec update` to configure for any supported tool without affecting others.
280282

281283

284+
## Updating OpenSpec
285+
286+
1. **Upgrade the package**
287+
- Local dependency: `pnpm add @fission-ai/openspec@latest`
288+
- Global CLI: `npm install -g @fission-ai/openspec@latest`
289+
2. **Refresh agent instructions**
290+
- Run `openspec update` inside each project to regenerate AI instructions and refresh slash-command bindings.
291+
292+
Run the update step after every version bump (or when switching tools) so your agents always pick up the latest guidance.
293+
294+
282295
## Contributing
283296

284-
- Install dependencies: `npm install`
285-
- Build: `npm run build`
286-
- Test: `npm test`
287-
- Develop CLI locally: `npm run dev` or `npm run dev:cli`
297+
- Install dependencies: `pnpm install`
298+
- Build: `pnpm run build`
299+
- Test: `pnpm test`
300+
- Develop CLI locally: `pnpm run dev` or `pnpm run dev:cli`
288301
- Conventional commits (one-line): `type(scope): subject`
289302

290303
## License
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Add AGENTS.md Standard Support To Init/Update
2+
3+
## Summary
4+
- Teach `openspec init` to manage a root-level `AGENTS.md` file using the same marker system as `CLAUDE.md`.
5+
- Allow `openspec update` to refresh or scaffold that root `AGENTS.md` so AGENTS-compatible tools always receive current instructions.
6+
- Keep the existing `openspec/AGENTS.md` template as the canonical source while ensuring assistants that read `AGENTS.md` opt-in instructions get the latest guidance automatically.
7+
8+
## Motivation
9+
The README now points teams to AGENTS.md-compatible assistants, but the CLI only manages `CLAUDE.md`. Projects must hand-roll a root `AGENTS.md` file to benefit from the standard, and updates will drift unless maintainers remember to copy content manually. Extending `init` and `update` closes that gap so OpenSpec actually delivers on the promise of first-class AGENTS support.
10+
11+
## Proposal
12+
1. Extend the `openspec init` selection flow with an "AGENTS.md standard" option that creates or refreshes a root `AGENTS.md` file wrapped in OpenSpec markers, mirroring the existing CLAUDE integration.
13+
2. When generating the file, pull the managed content from the same template used in `openspec/AGENTS.md`, ensuring both locations stay in sync.
14+
3. Update `openspec update` so it always refreshes the root `AGENTS.md` (creating it if missing) alongside `openspec/AGENTS.md` and any other configured assistants.
15+
4. Document the new behavior in CLI specs and verify marker handling (no duplicates, preserve user content outside the block) with tests for both commands.
16+
17+
## Out of Scope
18+
- Adding additional AGENTS-specific prompts or workflows beyond the shared instructions block.
19+
- Non-interactive flags or bulk configuration for multiple standards in one run.
20+
- Broader restructuring of how templates are stored or loaded.
21+
22+
## Risks & Mitigations
23+
- **Risk:** Accidentally overwriting user-edited content surrounding the managed block.
24+
- **Mitigation:** Reuse the existing marker-update helper shared with `CLAUDE.md`, and add tests that cover files containing custom text before and after the block.
25+
- **Risk:** Divergence between `openspec/AGENTS.md` and the root file.
26+
- **Mitigation:** Source the root file content from the canonical template rather than duplicating strings inline.
27+
- **Risk:** Confusion about when the file is created.
28+
- **Mitigation:** Log creation vs update, and ensure help text references the AGENTS option during `init`.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## MODIFIED Requirements
2+
### Requirement: AI Tool Configuration
3+
The command SHALL configure AI coding assistants with OpenSpec instructions based on user selection.
4+
5+
#### Scenario: Prompting for AI tool selection
6+
7+
- **WHEN** run
8+
- **THEN** prompt user to select AI tools to configure:
9+
- Claude Code
10+
- AGENTS.md standard
11+
- **AND** show disabled options as "coming soon" (not selectable):
12+
- Cursor (coming soon)
13+
- Aider (coming soon)
14+
- Continue (coming soon)
15+
16+
### Requirement: AI Tool Configuration Details
17+
The command SHALL properly configure selected AI tools with OpenSpec-specific instructions using a marker system.
18+
19+
#### Scenario: Configuring Claude Code
20+
21+
- **WHEN** Claude Code is selected
22+
- **THEN** create or update `CLAUDE.md` in the project root directory (not inside openspec/)
23+
24+
#### Scenario: Configuring AGENTS standard
25+
26+
- **WHEN** the AGENTS.md standard is selected
27+
- **THEN** create or update `AGENTS.md` in the project root directory (not inside openspec/)
28+
29+
#### Scenario: Creating new CLAUDE.md
30+
31+
- **WHEN** CLAUDE.md does not exist
32+
- **THEN** create new file with OpenSpec content wrapped in markers:
33+
```markdown
34+
<!-- OPENSPEC:START -->
35+
# OpenSpec Project
36+
37+
This document provides instructions for AI coding assistants on how to use OpenSpec conventions for spec-driven development. Follow these rules precisely when working on OpenSpec-enabled projects.
38+
39+
This project uses OpenSpec for spec-driven development. Specifications are the source of truth.
40+
41+
See @openspec/AGENTS.md for detailed conventions and guidelines.
42+
<!-- OPENSPEC:END -->
43+
```
44+
45+
#### Scenario: Creating new AGENTS.md
46+
47+
- **WHEN** AGENTS.md does not exist in the project root
48+
- **THEN** create new file with OpenSpec content wrapped in markers using the same template as CLAUDE.md
49+
50+
#### Scenario: Updating existing CLAUDE.md
51+
52+
- **WHEN** CLAUDE.md already exists
53+
- **THEN** preserve all existing content
54+
- **AND** insert OpenSpec content at the beginning of the file using markers
55+
- **AND** ensure markers don't duplicate if they already exist
56+
57+
#### Scenario: Updating existing AGENTS.md
58+
59+
- **WHEN** AGENTS.md already exists in the project root
60+
- **THEN** preserve all existing content
61+
- **AND** ensure the OpenSpec-managed block at the beginning of the file is refreshed without duplicating markers
62+
63+
#### Scenario: Managing content with markers
64+
65+
- **WHEN** using the marker system
66+
- **THEN** use `<!-- OPENSPEC:START -->` to mark the beginning of managed content
67+
- **AND** use `<!-- OPENSPEC:END -->` to mark the end of managed content
68+
- **AND** allow OpenSpec to update its content without affecting user customizations
69+
- **AND** preserve all content outside the markers intact
70+
71+
WHY use markers:
72+
- Users may have existing CLAUDE.md or AGENTS.md instructions they want to keep
73+
- OpenSpec can update its instructions in future versions
74+
- Clear boundary between OpenSpec-managed and user-managed content
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## MODIFIED Requirements
2+
### Requirement: Update Behavior
3+
The update command SHALL update OpenSpec instruction files to the latest templates in a team-friendly manner.
4+
5+
#### Scenario: Running update command
6+
7+
- **WHEN** a user runs `openspec update`
8+
- **THEN** the command SHALL:
9+
- Check if the `openspec` directory exists
10+
- Replace `openspec/AGENTS.md` with the latest template (complete replacement)
11+
- Create or refresh a root-level `AGENTS.md` file using the managed marker block (create if missing)
12+
- Update **only existing** AI tool configuration files (e.g., CLAUDE.md)
13+
- Check each registered AI tool configurator
14+
- For each configurator, check if its file exists
15+
- Update only files that already exist using their markers
16+
- Preserve user content outside markers
17+
- Display success message listing updated files
18+
19+
### Requirement: Tool-Agnostic Updates
20+
The update command SHALL handle file updates in a predictable and safe manner while respecting team tool choices.
21+
22+
#### Scenario: Updating files
23+
24+
- **WHEN** updating files
25+
- **THEN** completely replace `openspec/AGENTS.md` with the latest template
26+
- **AND** create or update the root-level `AGENTS.md` using the OpenSpec markers
27+
- **AND** update only the OpenSpec-managed blocks in **existing** AI tool files using markers
28+
- **AND** use the default directory name `openspec`
29+
- **AND** be idempotent (repeated runs have no additional effect)
30+
- **AND** respect team members' AI tool choices by not creating additional tool files beyond the root `AGENTS.md`
31+
32+
### Requirement: Core Files Always Updated
33+
The update command SHALL always update the core OpenSpec files and display an ASCII-safe success message.
34+
35+
#### Scenario: Successful update
36+
37+
- **WHEN** the update completes successfully
38+
- **THEN** replace `openspec/AGENTS.md` with the latest template
39+
- **AND** ensure the root-level `AGENTS.md` matches the latest template via the marker block
40+
- **AND** update existing AI tool configuration files within markers
41+
- **AND** display the message: "Updated OpenSpec instructions"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Implementation Tasks
2+
3+
## 1. Extend Init Workflow
4+
- [ ] 1.1 Add an "AGENTS.md standard" option to the `openspec init` tool-selection prompt, respecting the existing UI conventions.
5+
- [ ] 1.2 Generate or refresh a root-level `AGENTS.md` file using the OpenSpec markers when that option is selected, sourcing content from the canonical template.
6+
7+
## 2. Enhance Update Command
8+
- [ ] 2.1 Ensure `openspec update` writes the root `AGENTS.md` from the latest template (creating it if missing) alongside `openspec/AGENTS.md`.
9+
- [ ] 2.2 Update success messaging and logging to reflect creation vs refresh of the AGENTS standard file.
10+
11+
## 3. Shared Template Handling
12+
- [ ] 3.1 Refactor template utilities if necessary so both commands reuse the same content without duplication.
13+
- [ ] 3.2 Add automated tests covering init/update flows for projects with and without an existing `AGENTS.md`, ensuring markers behave correctly.
14+
15+
## 4. Documentation
16+
- [ ] 4.1 Update CLI specs and user-facing docs to describe AGENTS standard support.
17+
- [ ] 4.2 Run `openspec validate add-agents-md-config --strict` and document any notable behavior changes.

0 commit comments

Comments
 (0)