|
2 | 2 |
|
3 | 3 | ## Session Start |
4 | 4 |
|
5 | | -- **Always** read `tasks/lessons.md` at the beginning of each session before doing any work |
6 | | -- Apply relevant lessons to the current task |
| 5 | +- Read `tasks/lessons.md` before doing any work. Apply relevant lessons. |
7 | 6 |
|
8 | | -## Workflow Orchestration |
| 7 | +## Workflow |
9 | 8 |
|
10 | | -### 1. Plan Node Default |
| 9 | +### Planning |
11 | 10 |
|
12 | | -- Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions) |
13 | | -- If something goes sideways, STOP and re-plan immediately - don't keep pushing |
14 | | -- Use plan mode for verification steps, not just building |
15 | | -- Write detailed specs upfront to reduce ambiguity |
| 11 | +- Enter plan mode for any non-trivial task (3+ steps or architectural decisions). Write plan to `tasks/todo.md`. |
| 12 | +- If something goes sideways, STOP and re-plan — don't keep pushing. |
| 13 | +- Check in before starting implementation. Mark items complete as you go. |
16 | 14 |
|
17 | | -### 2. Subagent Strategy |
| 15 | +### Subagents |
18 | 16 |
|
19 | | -- Use subagents liberally to keep main context window clean |
20 | | -- Offload research, exploration, and parallel analysis to subagents |
21 | | -- For complex problems, throw more compute at it via subagents |
22 | | -- One tack per subagent for focused execution |
| 17 | +- Use subagents liberally for research, exploration, and parallel analysis. One tack per subagent. |
23 | 18 |
|
24 | | -### 3. Self-Improvement Loop |
| 19 | +### Lessons |
25 | 20 |
|
26 | | -- **When to amend** `tasks/lessons.md`: whenever something turns out wrong — user correction, test failure, CI failure, code review feedback, or any other signal that a mistake was made |
27 | | -- **How to amend**: add a bullet with (1) what went wrong, (2) the root cause, (3) a rule that prevents the same mistake |
28 | | -- **Best practice for AI agents**: updating lessons is the primary way to persist learning across sessions; agents lack long-term memory, so `tasks/lessons.md` is the project-specific memory that reduces repeated mistakes |
29 | | -- Write rules for yourself that prevent the same mistake |
30 | | -- Ruthlessly iterate on these lessons until mistake rate drops |
31 | | -- Review lessons at session start for relevant project |
| 21 | +- **When**: user correction, test failure, CI failure, code review feedback, or any other mistake signal. |
| 22 | +- **How**: add a bullet to `tasks/lessons.md` with (1) what went wrong, (2) root cause, (3) a rule that prevents recurrence. |
| 23 | +- This is the primary cross-session memory — ruthlessly iterate until mistake rate drops. |
32 | 24 |
|
33 | | -### 4. Verification Before Done |
| 25 | +### Verification |
34 | 26 |
|
35 | | -- Never mark a task complete without proving it works |
36 | | -- **After every feature/story completion**: Use the `post-feature-qa` skill (`.agents/skills/post-feature-qa/`) — run the QA checklist, ensure tests cover edge cases and implementation aligns with the story, fix gaps before marking done |
37 | | -- Diff behavior between main and your changes when relevant |
| 27 | +- Never mark a task complete without proving it works — run tests, check logs, demonstrate correctness. |
| 28 | +- After every feature/story: use `post-feature-qa` skill (`.agents/skills/post-feature-qa/`). |
38 | 29 | - Ask yourself: "Would a staff engineer approve this?" |
39 | | -- Run tests, check logs, demonstrate correctness |
40 | 30 |
|
41 | | -### 5. Demand Elegance (Balanced) |
| 31 | +### Elegance |
42 | 32 |
|
43 | 33 | - For non-trivial changes: pause and ask "is there a more elegant way?" |
44 | | -- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution" |
45 | | -- Skip this for simple, obvious fixes - don't over-engineer |
46 | | -- Challenge your own work before presenting it |
| 34 | +- Skip this for simple, obvious fixes — don't over-engineer. |
47 | 35 |
|
48 | | -### 6. Autonomous Bug Fixing |
| 36 | +### Bug Fixing |
49 | 37 |
|
50 | | -- When given a bug report: just fix it. Don't ask for hand-holding |
51 | | -- Point at logs, errors, failing tests - then resolve them |
52 | | -- Zero context switching required from the user |
53 | | -- Go fix failing CI tests without being told how |
54 | | - |
55 | | -## Task Management |
56 | | - |
57 | | -1. **Plan First**: Write plan to `tasks/todo.md` with checkable items |
58 | | -2. **Verify Plan**: Check in before starting implementation |
59 | | -3. **Track Progress**: Mark items complete as you go |
60 | | -4. **Explain Changes**: High-level summary at each step |
61 | | -5. **Document Results**: Add review section to `tasks/todo.md` |
62 | | -6. **Capture Lessons**: Update `tasks/lessons.md` after corrections — see "When to amend" and "How to amend" in Self-Improvement Loop above |
| 38 | +- When given a bug report: just fix it. Find root cause, point at logs/errors, resolve. Zero hand-holding. |
63 | 39 |
|
64 | 40 | ## Skills |
65 | 41 |
|
66 | | -- **post-feature-qa** (`.agents/skills/post-feature-qa/`) — Apply after every feature or story implementation. Act as senior QA: verify test coverage for all edge cases and story alignment; produce QA report; fix gaps before claiming complete. |
67 | | -- **add-agent-target** (`.agents/skills/add-agent-target/`) — Use when adding support for a new AI agent target. Requires current official-doc research, full import/generate implementation, rich realistic fixtures, complete unit/integration/e2e coverage, docs updates, and final QA. |
| 42 | +- **post-feature-qa** — Apply after every feature/story. Senior QA: verify edge-case coverage and story alignment. |
| 43 | +- **add-agent-target** — Use when adding a new AI agent target. Covers research, implementation, fixtures, full test coverage, docs. |
68 | 44 |
|
69 | 45 | ## Core Principles |
70 | 46 |
|
71 | | -- **Simplicity First**: Make every change as simple as possible. Impact minimal code. |
| 47 | +- **Simplicity**: Make every change as simple as possible. Only touch what's necessary. |
72 | 48 | - **No Laziness**: Find root causes. No temporary fixes. Senior developer standards. |
73 | | -- **Minimal Impact**: Changes should only touch what's necessary. Avoid introducing bugs. |
74 | 49 |
|
75 | | -## Project-Specific Rules |
| 50 | +## Project Rules |
76 | 51 |
|
77 | | -- **TDD mandatory**: Write failing tests FIRST, then implement. No exceptions. |
| 52 | +- **TDD mandatory**: Write failing tests FIRST, then implement. |
78 | 53 | - **Max file size**: 200 lines. Split by responsibility if larger. |
79 | 54 | - **No classes unless stateful**: Prefer pure functions + types. |
80 | 55 | - **No `any`**: Use `unknown` + narrowing. |
81 | 56 | - **Config source of truth**: `.agentsmesh/` directory. Generated files are artifacts. |
82 | 57 | - **Test naming**: `{module}.test.ts` colocated with source. Integration tests in `tests/integration/`. |
83 | | -- **Generated artifact tests must be strict**: For generated file structures, assert exact file paths, exact file counts, and exact referenced wrapper/script sets. Do not use loose checks like "at least one file", broad `some(...)`, or prefix-only path assertions when the full output set is known. |
| 58 | +- **Generated artifact tests must be strict**: Assert exact file paths, exact file counts, and exact referenced wrapper/script sets. No loose checks (`some(...)`, prefix-only, "at least one"). |
84 | 59 | - **Commit format**: conventional commits — `feat|fix|test|refactor(scope): message` |
85 | | -- **README must stay current**: Any change to CLI commands, flags, config schema, supported targets, or canonical file formats **must** be reflected in `README.md` before the task is marked complete. Treat the README as part of the API surface. |
86 | | -- **Website docs must stay current**: Any change to CLI commands, flags, config schema, supported targets, canonical file formats, or other user-facing behavior **must** also be reflected in the documentation website (`website/src/content/docs/`). The website is the primary public documentation — treat it with the same rigor as `README.md`. |
| 60 | +- **Docs must stay current**: Any change to CLI commands, flags, config schema, supported targets, or canonical file formats **must** be reflected in both `README.md` and the website (`website/src/content/docs/`) before the task is marked complete. |
| 61 | +- **Target data single source of truth** — do **not** hardcode target lists or support levels outside this chain: |
| 62 | + 1. `src/targets/catalog/target-ids.ts` (`TARGET_IDS`) = canonical target ID list. Each target's `capabilities` in `src/targets/<name>/index.ts` = feature support levels. |
| 63 | + 2. `src/core/matrix/data.ts` (`SUPPORT_MATRIX`) = built dynamically from descriptors. Never hardcode. |
| 64 | + 3. `website/src/content/docs/reference/supported-tools.mdx` = **single docs page** for per-target support. All other pages link here — no duplicate tables. |
| 65 | + 4. `README.md` matrix must stay in sync with code capabilities. |
| 66 | + 5. No hardcoded target counts or enumerations on homepage, CLI overview, or other pages. Use generic language and link to the matrix. |
| 67 | + 6. Adding/changing a target: update `target-ids.ts` + descriptor → `supported-tools.mdx` → `README.md` matrix. No other docs pages should need changes. |
87 | 68 | - **Refer to PRD**: `docs/prd-v2-complete.md` for architecture decisions |
88 | 69 | - **Refer to tasks**: `docs/agentsmesh-ai-first-tasks.md` for current task specs |
89 | 70 |
|
90 | 71 | ## AgentsMesh Generation Contract |
91 | 72 |
|
92 | | -AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is the `.agentsmesh` directory at the project root; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports. |
| 73 | +AgentsMesh syncs AI coding tool configuration from a single canonical `.agentsmesh` directory. All target-specific files (`.claude/`, `.cursor/`, `AGENTS.md`, etc.) are generated artifacts — edit canonical config first, then regenerate. The import/generate contract is bidirectional and lossless: embedded or projected features round-trip without data loss. |
0 commit comments