code-ai-installer 4.0.1-a → 4.0.1-c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/dist/catalog.js +1 -1
- package/dist/contentTransformer.d.ts +1 -1
- package/dist/contentTransformer.js +39 -0
- package/dist/index.js +10 -5
- package/dist/mcp/cli.js +4 -4
- package/dist/mcp/config.js +8 -6
- package/dist/mcp/scorecard.d.ts +2 -2
- package/dist/mcp/task_state.d.ts +2 -2
- package/dist/mcp/tools/advance_gate.js +1 -1
- package/dist/mcp/tools/classify_gate.d.ts +2 -2
- package/dist/mcp/tools/classify_gate.js +2 -2
- package/dist/mcp/tools/load_role.d.ts +2 -2
- package/dist/mcp/tools/load_role.js +2 -2
- package/dist/mcp/tools/report_exception.d.ts +3 -3
- package/dist/mcp/tools/report_exception.js +4 -4
- package/dist/mcp/tools/request_decision.d.ts +3 -3
- package/dist/mcp/tools/request_decision.js +5 -5
- package/dist/mcp/tools/review_proposal.d.ts +1 -1
- package/dist/mcp/tools/review_proposal.js +6 -6
- package/dist/mcp/tools/sign_off.d.ts +2 -2
- package/dist/mcp/tools/sign_off.js +7 -7
- package/dist/mcp/tools/verify_claim.d.ts +1 -1
- package/dist/mcp/tools/verify_claim.js +1 -1
- package/dist/mcp_setup.d.ts +85 -29
- package/dist/mcp_setup.js +184 -62
- package/dist/platforms/adapters.js +54 -19
- package/dist/shared/frontmatter.js +1 -1
- package/dist/shared/persona.d.ts +1 -1
- package/dist/shared/persona.js +1 -1
- package/dist/shared/pipeline.d.ts +10 -10
- package/dist/shared/pipeline.js +7 -7
- package/dist/shared/tools.d.ts +15 -15
- package/dist/shared/tools.js +3 -3
- package/dist/shared/vocabulary.d.ts +4 -4
- package/dist/shared/vocabulary.js +4 -4
- package/dist/types.d.ts +1 -1
- package/domains/analytics/.agents/workflows/analytics-pipeline-rules.md +13 -3
- package/domains/analytics/.agents/workflows/analyze.md +1 -0
- package/domains/analytics/.agents/workflows/quick-insight.md +1 -0
- package/domains/analytics/locales/en/.agents/workflows/analytics-pipeline-rules.md +13 -3
- package/domains/analytics/locales/en/.agents/workflows/analyze.md +1 -0
- package/domains/analytics/locales/en/.agents/workflows/quick-insight.md +1 -0
- package/domains/analytics/locales/en/agents/interviewer.md +2 -1
- package/domains/analytics/locales/en/agents/layouter.md +2 -1
- package/domains/analytics/locales/en/agents/mediator.md +2 -1
- package/domains/analytics/locales/en/agents/researcher.md +2 -1
- package/domains/analytics/locales/en/agents/strategist.md +2 -1
- package/domains/analytics/pipeline.yaml +10 -10
- package/domains/content/.agents/skills/content-release-gate/SKILL.md +3 -5
- package/domains/content/.agents/workflows/content-pipeline-rules.md +14 -11
- package/domains/content/.agents/workflows/edit-content.md +0 -1
- package/domains/content/.agents/workflows/quick-post.md +0 -1
- package/domains/content/.agents/workflows/start-content.md +0 -1
- package/domains/content/agents/conductor.md +1 -2
- package/domains/content/locales/en/.agents/skills/content-release-gate/SKILL.md +3 -5
- package/domains/content/locales/en/.agents/workflows/content-pipeline-rules.md +14 -11
- package/domains/content/locales/en/.agents/workflows/edit-content.md +0 -1
- package/domains/content/locales/en/.agents/workflows/quick-post.md +0 -1
- package/domains/content/locales/en/.agents/workflows/start-content.md +0 -1
- package/domains/content/locales/en/agents/conductor.md +1 -2
- package/domains/content/pipeline.yaml +8 -8
- package/domains/development/.agents/skills/handoff/SKILL.md +276 -276
- package/domains/development/.agents/skills/lava-flow-legacy-detection/SKILL.md +197 -197
- package/domains/development/.agents/skills/mcp-integration/SKILL.md +211 -211
- package/domains/development/.agents/skills/qa-test-data-management/SKILL.md +250 -250
- package/domains/development/.agents/workflows/bugfix.md +16 -82
- package/domains/development/.agents/workflows/hotfix.md +16 -66
- package/domains/development/.agents/workflows/pipeline-rules.md +49 -132
- package/domains/development/.agents/workflows/start-task.md +17 -121
- package/domains/development/AGENTS.md +8 -3
- package/domains/development/agents/architect.md +247 -247
- package/domains/development/agents/conductor.md +363 -363
- package/domains/development/agents/devops.md +297 -297
- package/domains/development/agents/reviewer.md +293 -293
- package/domains/development/agents/senior_full_stack.md +295 -295
- package/domains/development/agents/tester.md +395 -395
- package/domains/development/locales/en/.agents/skills/handoff/SKILL.md +276 -276
- package/domains/development/locales/en/.agents/skills/lava-flow-legacy-detection/SKILL.md +197 -197
- package/domains/development/locales/en/.agents/skills/mcp-integration/SKILL.md +211 -211
- package/domains/development/locales/en/.agents/skills/qa-test-data-management/SKILL.md +250 -250
- package/domains/development/locales/en/.agents/workflows/bugfix.md +16 -82
- package/domains/development/locales/en/.agents/workflows/hotfix.md +15 -65
- package/domains/development/locales/en/.agents/workflows/pipeline-rules.md +48 -131
- package/domains/development/locales/en/.agents/workflows/start-task.md +17 -121
- package/domains/development/locales/en/AGENTS.md +15 -0
- package/domains/development/locales/en/agents/architect.md +247 -247
- package/domains/development/locales/en/agents/conductor.md +363 -363
- package/domains/development/locales/en/agents/devops.md +297 -297
- package/domains/development/locales/en/agents/reviewer.md +293 -293
- package/domains/development/locales/en/agents/senior_full_stack.md +295 -295
- package/domains/development/locales/en/agents/tester.md +395 -395
- package/domains/development/locales/en/prompt-examples.md +34 -120
- package/domains/development/pipeline.yaml +150 -135
- package/domains/development/prompt-examples.md +33 -119
- package/domains/product/.agents/workflows/product-pipeline-rules.md +13 -2
- package/domains/product/.agents/workflows/quick-pm.md +1 -1
- package/domains/product/.agents/workflows/shape-prioritize.md +1 -0
- package/domains/product/.agents/workflows/ship-right-thing.md +1 -0
- package/domains/product/.agents/workflows/spec.md +1 -0
- package/domains/product/agents/tech_lead.md +1 -1
- package/domains/product/locales/en/.agents/workflows/product-pipeline-rules.md +13 -2
- package/domains/product/locales/en/.agents/workflows/quick-pm.md +1 -1
- package/domains/product/locales/en/.agents/workflows/shape-prioritize.md +1 -0
- package/domains/product/locales/en/.agents/workflows/ship-right-thing.md +1 -0
- package/domains/product/locales/en/.agents/workflows/spec.md +1 -0
- package/domains/product/locales/en/agents/conductor.md +2 -2
- package/domains/product/locales/en/agents/data_analyst.md +2 -1
- package/domains/product/locales/en/agents/designer.md +2 -1
- package/domains/product/locales/en/agents/discovery.md +2 -1
- package/domains/product/locales/en/agents/layouter.md +2 -1
- package/domains/product/locales/en/agents/mediator.md +2 -1
- package/domains/product/locales/en/agents/pm.md +2 -1
- package/domains/product/locales/en/agents/product_strategist.md +2 -1
- package/domains/product/locales/en/agents/tech_lead.md +3 -2
- package/domains/product/locales/en/agents/ux_designer.md +2 -1
- package/domains/product/pipeline.yaml +12 -12
- package/package.json +5 -5
- package/domains/analytics/CONTEXT.md +0 -25
- package/domains/analytics/locales/en/CONTEXT.md +0 -25
- package/domains/content/CONTEXT.md +0 -19
- package/domains/content/locales/en/CONTEXT.md +0 -19
- package/domains/development/.agents/workflows/auto-restart-containers.md +0 -56
- package/domains/development/CONTEXT.md +0 -62
- package/domains/development/locales/en/.agents/workflows/auto-restart-containers.md +0 -24
- package/domains/development/locales/en/CONTEXT.md +0 -62
- package/domains/product/CONTEXT.md +0 -40
- package/domains/product/locales/en/CONTEXT.md +0 -40
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mcp-integration
|
|
3
|
-
description: "Which MCP tool to call and in what order — gate ritual, recording discipline, action tools for all development agents."
|
|
4
|
-
type: mandatory
|
|
5
|
-
domain: development
|
|
6
|
-
owners:
|
|
7
|
-
- architect
|
|
8
|
-
- conductor
|
|
9
|
-
- devops
|
|
10
|
-
- product_manager
|
|
11
|
-
- reviewer
|
|
12
|
-
- senior_full_stack
|
|
13
|
-
- tester
|
|
14
|
-
- ux_ui_designer
|
|
15
|
-
gates:
|
|
16
|
-
- PM
|
|
17
|
-
- UX
|
|
18
|
-
- ARCH
|
|
19
|
-
- DEV
|
|
20
|
-
- REV
|
|
21
|
-
- OPS
|
|
22
|
-
- TEST
|
|
23
|
-
- RG
|
|
24
|
-
tech:
|
|
25
|
-
- mcp
|
|
26
|
-
topic:
|
|
27
|
-
- general
|
|
28
|
-
triggers:
|
|
29
|
-
- record_decision
|
|
30
|
-
- request_decision
|
|
31
|
-
- classify_gate
|
|
32
|
-
- advance_gate
|
|
33
|
-
- submit_artifact
|
|
34
|
-
- list_skills
|
|
35
|
-
- get_skill
|
|
36
|
-
- load_role
|
|
37
|
-
- MCP
|
|
38
|
-
- code-ai MCP
|
|
39
|
-
- gate flow
|
|
40
|
-
related:
|
|
41
|
-
- karpathy-guidelines
|
|
42
|
-
- code-review-checklist
|
|
43
|
-
- adr-log
|
|
44
|
-
budget_lines: 250
|
|
45
|
-
schema_version: 1
|
|
46
|
-
license: MIT
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# MCP Integration
|
|
51
|
-
|
|
52
|
-
Rules for working with the code-ai MCP server for all development agents. Which tool to call when, in what order, what to record, what mistakes to avoid.
|
|
53
|
-
|
|
54
|
-
> If the MCP server is not registered in `.mcp.json` — fall back to file reads with a `report_exception` note. Do not stay silent.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## 1. When to apply
|
|
59
|
-
|
|
60
|
-
**Triggers:** any task in the development domain that passes through gates (PM/UX/ARCH/DEV/REV/OPS/TEST/RG). Which is — almost any task.
|
|
61
|
-
|
|
62
|
-
**Output:** the tool was invoked correctly, its result was used in the current phase, and recorded via `record_decision` or `submit_artifact` when needed.
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## 2. What is code-ai MCP
|
|
67
|
-
|
|
68
|
-
A local MCP server (stdio transport) with 26 tools. State lives in `.code-ai/state/` (JsonlStore — append-only, files `decisions.jsonl`, `exceptions.jsonl`, `artifacts/<task>.jsonl`). MempalaceStore is an optional mirror, not the source of truth.
|
|
69
|
-
|
|
70
|
-
The server is registered by the installer (`.mcp.json` is written automatically on `--target=claude`). If the installer did not run — records can be made manually in `.code-ai/state/`, but the MCP tools are preferred: they validate input via zod.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## 3. Group 1 — Navigation (4 tools)
|
|
75
|
-
|
|
76
|
-
**`list_skills`** — get the full list of domain skills with frontmatter. Call at task start to understand what you have. The parser is permissive — it skips skills with broken frontmatter (see `run_drift_audit` if something was expected but did not appear).
|
|
77
|
-
|
|
78
|
-
**`get_skill`** — get a SKILL.md by name. Use instead of manual file reading — get_skill returns frontmatter already parsed and the markdown body separately.
|
|
79
|
-
|
|
80
|
-
**`load_role`** — get an agent profile (prompt + list of skills the agent may call). Call first when a task lands on your role.
|
|
81
|
-
|
|
82
|
-
**`regenerate_manifest`** — rebuild `manifest.json` after skill edits. Call when you added/removed/renamed a skill.
|
|
83
|
-
|
|
84
|
-
**Order at task start:** `load_role` → `list_skills` → pick the ones you need → `get_skill` for each.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 4. Group 2 — Gate flow (5 tools)
|
|
89
|
-
|
|
90
|
-
This is the gate-passage ritual. **Every gate** must follow these steps in order.
|
|
91
|
-
|
|
92
|
-
**`classify_gate`** — classify the task before starting work on a gate. Returns `auto_resolve` (green path, artifact still required for audit), `fork` (needs a
|
|
93
|
-
|
|
94
|
-
**`request_decision`** — request a decision from
|
|
95
|
-
|
|
96
|
-
**`current_gate`** — where the task currently is. Useful when context was lost or you switched between tasks.
|
|
97
|
-
|
|
98
|
-
**`advance_gate`** — push the task into the next gate. **Only after** all artifacts of the current gate are submitted and sign_off is in place.
|
|
99
|
-
|
|
100
|
-
**`sign_off`** — sign the current gate. Sign_off without a prior `submit_artifact` is an anti-pattern (see §8). Result first, signature second.
|
|
101
|
-
|
|
102
|
-
**Canonical gate ritual:** `current_gate` (understand where you are) → `classify_gate` → if fork: `request_decision` → wait → `record_decision` → continue → `submit_artifact` → `verify_claim` (where applicable) → `sign_off` → `advance_gate`.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## 5. Group 3 — Actions (15 tools)
|
|
107
|
-
|
|
108
|
-
Tools that **do** something in the project. Each answers one DoD question.
|
|
109
|
-
|
|
110
|
-
**`run_tests`** — a vitest/jest/pytest wrapper. Call when the DoD says "tests are green". Returns `numPassedTests`, `numFailedTests`, `failureMessages`. Used by `verify_claim` for `claim_type=tests_pass`.
|
|
111
|
-
|
|
112
|
-
**`check_lint`** — linter check. Returns `clean: true/false` plus a list of lint failures. DoD claim_type `lint_clean`.
|
|
113
|
-
|
|
114
|
-
**`build`** — `tsc` or equivalent. Parses `TSxxxx` errors. DoD claim_type `build_succeeds`.
|
|
115
|
-
|
|
116
|
-
**`apply_diff`** — apply a git diff from stdin. Cleaner than manual edits across many Edit/Write calls — especially for multi-file patches.
|
|
117
|
-
|
|
118
|
-
**`git_commit`** — commit (with paths or `-a`). Uses a tempfile for the message — heredoc with quotes is unreliable on Windows.
|
|
119
|
-
|
|
120
|
-
**`run_drift_audit`** — find divergence between skills on disk and AGENTS.yaml/manifest.json. The parser is permissive — it sees broken skills (unlike `list_skills` which skips them).
|
|
121
|
-
|
|
122
|
-
**`e2e_playwright`** — Playwright runner. Browsers are not downloaded by default (`.npmrc` skip flag) — install manually if needed.
|
|
123
|
-
|
|
124
|
-
**`docker_compose`** — wrapper over `docker compose` (up/down/ps/logs). Skipped if the Docker daemon is not running.
|
|
125
|
-
|
|
126
|
-
**`dependency_supply_chain`** — `npm audit --json` parser. Returns vulnerabilities with severity. DoD claim_type `no_critical_vulns`.
|
|
127
|
-
|
|
128
|
-
**`verify_claim`** — meta-tool. Takes a `claim_type` (`tests_pass` / `lint_clean` / `build_succeeds` / `no_critical_vulns` / `e2e_passes` / `docker_runs` / `custom`), calls the right action tool, returns a structured verdict. `custom` is still a stub — for it, human verification (see DEV-103).
|
|
129
|
-
|
|
130
|
-
**`audit_budget_compliance`** — file budget compliance check: declared_budget > schema_max (catches schema rejection latent bugs — DEV-107 RoleFrontmatter case) and actual_lines > declared_budget. Across all agent.md + SKILL.md in the given domain (RU + EN). Call periodically or before substantial edits to agent.md / SKILL.md.
|
|
131
|
-
|
|
132
|
-
**`audit_bilocale_parity`** — RU/EN locale parity check: pairs each agent.md / SKILL.md with its sibling in the other locale and reports declared_mismatch (differing budget_lines), actual_mismatch (differing line counts — the design-intake drift in DEV-114), and orphan (file present in one locale only). Read-only. Call before/after edits that touch a single locale.
|
|
133
|
-
|
|
134
|
-
**`aggregate_run_metrics`** — the Auditor's data foundation. Computes deterministic per-agent (gate→role via pipeline.yaml) and per-workflow (mode) statistics from the completed-run ledger (`.code-ai/state/audit/runs.jsonl`): first-try rate, reworks, rollbacks, circuit-breaker trips, exceptions, classification breakdown. `min_runs` (default 3) guards small samples. Read-only, numbers only — judgment belongs to the Auditor agent.
|
|
135
|
-
|
|
136
|
-
**`propose_change`** — record an Auditor proposal (a draft change to an agent/skill) as a pending entry in the local store (`.code-ai/state/audit/proposals.jsonl`). Carries change_kind (edit_minor/add_asset/destructive → risk tier), rationale, evidence, threshold_met, and the inline draft. Pure surfacing — touches no asset; inert until approved/applied (item 4b).
|
|
137
|
-
|
|
138
|
-
**`list_proposals`** — list Auditor proposals (newest first), filters status/risk/domain. Read-only.
|
|
139
|
-
|
|
140
|
-
**`review_proposal`** — authorize a proposal status transition (approve/reject a pending one; mark an approved one applied) plus a mandatory report. Applies the autonomy matrix + the `.code-ai/config.json` toggle: `decided_by='auditor_auto'` may approve only low/additive AND only when the gate is OFF; destructive (high) and gate-ON always require
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## 6. Group 4 — Recording decisions (6 tools + 1 utility)
|
|
145
|
-
|
|
146
|
-
**`record_decision`** — write an ADR decision to `decisions.jsonl`. **Only after** `request_decision` if the decision needs
|
|
147
|
-
|
|
148
|
-
**`recent_decisions`** — last N decisions (filters by domain/signer/since). Use to understand the current task context.
|
|
149
|
-
|
|
150
|
-
**`audit_trail`** — the full audit trail of a task: all decisions + artifacts + exceptions in chronological order. Call before `sign_off` to make sure nothing was forgotten.
|
|
151
|
-
|
|
152
|
-
**`submit_artifact`** — submit an artifact of the current gate (e.g. spec.md, ADR draft, design doc). Without it you cannot `sign_off`.
|
|
153
|
-
|
|
154
|
-
**`list_artifacts`** / **`get_artifact`** — see what was already submitted in the task. Use to avoid duplicates.
|
|
155
|
-
|
|
156
|
-
**`report_exception`** — record an exception (gate-check failed). Do not use instead of an honest fix — exception means "I tried, didn't work, reason X, need a fork", not "workaround".
|
|
157
|
-
|
|
158
|
-
**Storage lives in JsonlStore** (append-only). No "overwrite" — only a new entry with `invalidates: <prev_id>` via `kg_invalidate` if a fact is outdated.
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## 7. Canonical rituals
|
|
163
|
-
|
|
164
|
-
### Ritual A — "Got a task"
|
|
165
|
-
```
|
|
166
|
-
1. load_role (understand what I can do)
|
|
167
|
-
2. list_skills (what exists in the domain)
|
|
168
|
-
3. current_gate (where the task is)
|
|
169
|
-
4. get_skill <name> (for each relevant skill)
|
|
170
|
-
5. classify_gate (start gate ritual)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Ritual B — "Closing a gate"
|
|
174
|
-
```
|
|
175
|
-
1. verify_claim (for each DoD claim_type with an automated check)
|
|
176
|
-
2. submit_artifact (artifacts of the gate)
|
|
177
|
-
3. audit_trail (last check — is everything in place)
|
|
178
|
-
4. sign_off (signature)
|
|
179
|
-
5. advance_gate (transition)
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Ritual C — "Architectural decision"
|
|
183
|
-
```
|
|
184
|
-
1. request_decision (creates ADR-PENDING-*)
|
|
185
|
-
2. (wait for
|
|
186
|
-
3. record_decision (finalizes the ADR with signer=
|
|
187
|
-
4. apply_diff (apply the changes as one patch if possible)
|
|
188
|
-
5. git_commit (commit with adr_id in the message)
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## 8. Anti-patterns
|
|
194
|
-
|
|
195
|
-
1. **`record_decision` without `request_decision`** for decisions that need
|
|
196
|
-
2. **`advance_gate` without `sign_off`** — the gate stays "unsigned", the next agent does not understand what is ready.
|
|
197
|
-
3. **`apply_diff` without `git_commit`** — changes sit in the working tree, the next session loses them or claims them as its own.
|
|
198
|
-
4. **Manual SKILL.md parsing** instead of `get_skill` — you skip frontmatter validation and catch a latent bug (see the DEV-103 list_skills lesson).
|
|
199
|
-
5. **`report_exception` instead of an honest fix** — exception is for "
|
|
200
|
-
6. **Calling MCP when the server is not registered** without a graceful fallback — silent failure is worse than an honest "MCP unavailable, fell back to file read".
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## 9. DoD
|
|
205
|
-
|
|
206
|
-
- [ ] gate ritual fully completed (classify → action → submit → sign_off → advance)
|
|
207
|
-
- [ ] all artifacts submitted via `submit_artifact`
|
|
208
|
-
- [ ] all decisions recorded via `record_decision` (with `request_decision` where
|
|
209
|
-
- [ ] exceptions recorded honestly via `report_exception` (if any)
|
|
210
|
-
- [ ] `verify_claim` called for every DoD claim with an automated check
|
|
211
|
-
- [ ] commits with MCP-coupled changes are made in a single batch (apply_diff → git_commit)
|
|
1
|
+
---
|
|
2
|
+
name: mcp-integration
|
|
3
|
+
description: "Which MCP tool to call and in what order — gate ritual, recording discipline, action tools for all development agents."
|
|
4
|
+
type: mandatory
|
|
5
|
+
domain: development
|
|
6
|
+
owners:
|
|
7
|
+
- architect
|
|
8
|
+
- conductor
|
|
9
|
+
- devops
|
|
10
|
+
- product_manager
|
|
11
|
+
- reviewer
|
|
12
|
+
- senior_full_stack
|
|
13
|
+
- tester
|
|
14
|
+
- ux_ui_designer
|
|
15
|
+
gates:
|
|
16
|
+
- PM
|
|
17
|
+
- UX
|
|
18
|
+
- ARCH
|
|
19
|
+
- DEV
|
|
20
|
+
- REV
|
|
21
|
+
- OPS
|
|
22
|
+
- TEST
|
|
23
|
+
- RG
|
|
24
|
+
tech:
|
|
25
|
+
- mcp
|
|
26
|
+
topic:
|
|
27
|
+
- general
|
|
28
|
+
triggers:
|
|
29
|
+
- record_decision
|
|
30
|
+
- request_decision
|
|
31
|
+
- classify_gate
|
|
32
|
+
- advance_gate
|
|
33
|
+
- submit_artifact
|
|
34
|
+
- list_skills
|
|
35
|
+
- get_skill
|
|
36
|
+
- load_role
|
|
37
|
+
- MCP
|
|
38
|
+
- code-ai MCP
|
|
39
|
+
- gate flow
|
|
40
|
+
related:
|
|
41
|
+
- karpathy-guidelines
|
|
42
|
+
- code-review-checklist
|
|
43
|
+
- adr-log
|
|
44
|
+
budget_lines: 250
|
|
45
|
+
schema_version: 1
|
|
46
|
+
license: MIT
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# MCP Integration
|
|
51
|
+
|
|
52
|
+
Rules for working with the code-ai MCP server for all development agents. Which tool to call when, in what order, what to record, what mistakes to avoid.
|
|
53
|
+
|
|
54
|
+
> If the MCP server is not registered in `.mcp.json` — fall back to file reads with a `report_exception` note. Do not stay silent.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 1. When to apply
|
|
59
|
+
|
|
60
|
+
**Triggers:** any task in the development domain that passes through gates (PM/UX/ARCH/DEV/REV/OPS/TEST/RG). Which is — almost any task.
|
|
61
|
+
|
|
62
|
+
**Output:** the tool was invoked correctly, its result was used in the current phase, and recorded via `record_decision` or `submit_artifact` when needed.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 2. What is code-ai MCP
|
|
67
|
+
|
|
68
|
+
A local MCP server (stdio transport) with 26 tools. State lives in `.code-ai/state/` (JsonlStore — append-only, files `decisions.jsonl`, `exceptions.jsonl`, `artifacts/<task>.jsonl`). MempalaceStore is an optional mirror, not the source of truth.
|
|
69
|
+
|
|
70
|
+
The server is registered by the installer (`.mcp.json` is written automatically on `--target=claude`). If the installer did not run — records can be made manually in `.code-ai/state/`, but the MCP tools are preferred: they validate input via zod.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 3. Group 1 — Navigation (4 tools)
|
|
75
|
+
|
|
76
|
+
**`list_skills`** — get the full list of domain skills with frontmatter. Call at task start to understand what you have. The parser is permissive — it skips skills with broken frontmatter (see `run_drift_audit` if something was expected but did not appear).
|
|
77
|
+
|
|
78
|
+
**`get_skill`** — get a SKILL.md by name. Use instead of manual file reading — get_skill returns frontmatter already parsed and the markdown body separately.
|
|
79
|
+
|
|
80
|
+
**`load_role`** — get an agent profile (prompt + list of skills the agent may call). Call first when a task lands on your role.
|
|
81
|
+
|
|
82
|
+
**`regenerate_manifest`** — rebuild `manifest.json` after skill edits. Call when you added/removed/renamed a skill.
|
|
83
|
+
|
|
84
|
+
**Order at task start:** `load_role` → `list_skills` → pick the ones you need → `get_skill` for each.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 4. Group 2 — Gate flow (5 tools)
|
|
89
|
+
|
|
90
|
+
This is the gate-passage ritual. **Every gate** must follow these steps in order.
|
|
91
|
+
|
|
92
|
+
**`classify_gate`** — classify the task before starting work on a gate. Returns `auto_resolve` (green path, artifact still required for audit), `fork` (needs a user decision — request it via `request_decision`) or `exception` (an automated check failed — write a breakdown to exceptions).
|
|
93
|
+
|
|
94
|
+
**`request_decision`** — request a decision from the user. Creates an ADR-PENDING-* entry in decisions.jsonl. Must be called **before** `record_decision` if the decision requires user approval. Do not stay silent and do not choose on your own — that violates `karpathy-guidelines §1`.
|
|
95
|
+
|
|
96
|
+
**`current_gate`** — where the task currently is. Useful when context was lost or you switched between tasks.
|
|
97
|
+
|
|
98
|
+
**`advance_gate`** — push the task into the next gate. **Only after** all artifacts of the current gate are submitted and sign_off is in place.
|
|
99
|
+
|
|
100
|
+
**`sign_off`** — sign the current gate. Sign_off without a prior `submit_artifact` is an anti-pattern (see §8). Result first, signature second.
|
|
101
|
+
|
|
102
|
+
**Canonical gate ritual:** `current_gate` (understand where you are) → `classify_gate` → if fork: `request_decision` → wait → `record_decision` → continue → `submit_artifact` → `verify_claim` (where applicable) → `sign_off` → `advance_gate`.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5. Group 3 — Actions (15 tools)
|
|
107
|
+
|
|
108
|
+
Tools that **do** something in the project. Each answers one DoD question.
|
|
109
|
+
|
|
110
|
+
**`run_tests`** — a vitest/jest/pytest wrapper. Call when the DoD says "tests are green". Returns `numPassedTests`, `numFailedTests`, `failureMessages`. Used by `verify_claim` for `claim_type=tests_pass`.
|
|
111
|
+
|
|
112
|
+
**`check_lint`** — linter check. Returns `clean: true/false` plus a list of lint failures. DoD claim_type `lint_clean`.
|
|
113
|
+
|
|
114
|
+
**`build`** — `tsc` or equivalent. Parses `TSxxxx` errors. DoD claim_type `build_succeeds`.
|
|
115
|
+
|
|
116
|
+
**`apply_diff`** — apply a git diff from stdin. Cleaner than manual edits across many Edit/Write calls — especially for multi-file patches.
|
|
117
|
+
|
|
118
|
+
**`git_commit`** — commit (with paths or `-a`). Uses a tempfile for the message — heredoc with quotes is unreliable on Windows.
|
|
119
|
+
|
|
120
|
+
**`run_drift_audit`** — find divergence between skills on disk and AGENTS.yaml/manifest.json. The parser is permissive — it sees broken skills (unlike `list_skills` which skips them).
|
|
121
|
+
|
|
122
|
+
**`e2e_playwright`** — Playwright runner. Browsers are not downloaded by default (`.npmrc` skip flag) — install manually if needed.
|
|
123
|
+
|
|
124
|
+
**`docker_compose`** — wrapper over `docker compose` (up/down/ps/logs). Skipped if the Docker daemon is not running.
|
|
125
|
+
|
|
126
|
+
**`dependency_supply_chain`** — `npm audit --json` parser. Returns vulnerabilities with severity. DoD claim_type `no_critical_vulns`.
|
|
127
|
+
|
|
128
|
+
**`verify_claim`** — meta-tool. Takes a `claim_type` (`tests_pass` / `lint_clean` / `build_succeeds` / `no_critical_vulns` / `e2e_passes` / `docker_runs` / `custom`), calls the right action tool, returns a structured verdict. `custom` is still a stub — for it, human verification (see DEV-103).
|
|
129
|
+
|
|
130
|
+
**`audit_budget_compliance`** — file budget compliance check: declared_budget > schema_max (catches schema rejection latent bugs — DEV-107 RoleFrontmatter case) and actual_lines > declared_budget. Across all agent.md + SKILL.md in the given domain (RU + EN). Call periodically or before substantial edits to agent.md / SKILL.md.
|
|
131
|
+
|
|
132
|
+
**`audit_bilocale_parity`** — RU/EN locale parity check: pairs each agent.md / SKILL.md with its sibling in the other locale and reports declared_mismatch (differing budget_lines), actual_mismatch (differing line counts — the design-intake drift in DEV-114), and orphan (file present in one locale only). Read-only. Call before/after edits that touch a single locale.
|
|
133
|
+
|
|
134
|
+
**`aggregate_run_metrics`** — the Auditor's data foundation. Computes deterministic per-agent (gate→role via pipeline.yaml) and per-workflow (mode) statistics from the completed-run ledger (`.code-ai/state/audit/runs.jsonl`): first-try rate, reworks, rollbacks, circuit-breaker trips, exceptions, classification breakdown. `min_runs` (default 3) guards small samples. Read-only, numbers only — judgment belongs to the Auditor agent.
|
|
135
|
+
|
|
136
|
+
**`propose_change`** — record an Auditor proposal (a draft change to an agent/skill) as a pending entry in the local store (`.code-ai/state/audit/proposals.jsonl`). Carries change_kind (edit_minor/add_asset/destructive → risk tier), rationale, evidence, threshold_met, and the inline draft. Pure surfacing — touches no asset; inert until approved/applied (item 4b).
|
|
137
|
+
|
|
138
|
+
**`list_proposals`** — list Auditor proposals (newest first), filters status/risk/domain. Read-only.
|
|
139
|
+
|
|
140
|
+
**`review_proposal`** — authorize a proposal status transition (approve/reject a pending one; mark an approved one applied) plus a mandatory report. Applies the autonomy matrix + the `.code-ai/config.json` toggle: `decided_by='auditor_auto'` may approve only low/additive AND only when the gate is OFF; destructive (high) and gate-ON always require user. Auto-adding a new skill also runs an additive-dedup guard — on overlap with an existing skill it routes to user instead of auto-adding. Authorization only — the byte write into the asset is a separate submit_artifact/edit step (see next_step).
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 6. Group 4 — Recording decisions (6 tools + 1 utility)
|
|
145
|
+
|
|
146
|
+
**`record_decision`** — write an ADR decision to `decisions.jsonl`. **Only after** `request_decision` if the decision needs the user's involvement. If the decision is mechanical (signer=mcp) — direct is fine, but set `signer: "mcp"` explicitly.
|
|
147
|
+
|
|
148
|
+
**`recent_decisions`** — last N decisions (filters by domain/signer/since). Use to understand the current task context.
|
|
149
|
+
|
|
150
|
+
**`audit_trail`** — the full audit trail of a task: all decisions + artifacts + exceptions in chronological order. Call before `sign_off` to make sure nothing was forgotten.
|
|
151
|
+
|
|
152
|
+
**`submit_artifact`** — submit an artifact of the current gate (e.g. spec.md, ADR draft, design doc). Without it you cannot `sign_off`.
|
|
153
|
+
|
|
154
|
+
**`list_artifacts`** / **`get_artifact`** — see what was already submitted in the task. Use to avoid duplicates.
|
|
155
|
+
|
|
156
|
+
**`report_exception`** — record an exception (gate-check failed). Do not use instead of an honest fix — exception means "I tried, didn't work, reason X, need a fork", not "workaround".
|
|
157
|
+
|
|
158
|
+
**Storage lives in JsonlStore** (append-only). No "overwrite" — only a new entry with `invalidates: <prev_id>` via `kg_invalidate` if a fact is outdated.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 7. Canonical rituals
|
|
163
|
+
|
|
164
|
+
### Ritual A — "Got a task"
|
|
165
|
+
```
|
|
166
|
+
1. load_role (understand what I can do)
|
|
167
|
+
2. list_skills (what exists in the domain)
|
|
168
|
+
3. current_gate (where the task is)
|
|
169
|
+
4. get_skill <name> (for each relevant skill)
|
|
170
|
+
5. classify_gate (start gate ritual)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Ritual B — "Closing a gate"
|
|
174
|
+
```
|
|
175
|
+
1. verify_claim (for each DoD claim_type with an automated check)
|
|
176
|
+
2. submit_artifact (artifacts of the gate)
|
|
177
|
+
3. audit_trail (last check — is everything in place)
|
|
178
|
+
4. sign_off (signature)
|
|
179
|
+
5. advance_gate (transition)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Ritual C — "Architectural decision"
|
|
183
|
+
```
|
|
184
|
+
1. request_decision (creates ADR-PENDING-*)
|
|
185
|
+
2. (wait for user approval)
|
|
186
|
+
3. record_decision (finalizes the ADR with signer=user)
|
|
187
|
+
4. apply_diff (apply the changes as one patch if possible)
|
|
188
|
+
5. git_commit (commit with adr_id in the message)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 8. Anti-patterns
|
|
194
|
+
|
|
195
|
+
1. **`record_decision` without `request_decision`** for decisions that need user approval — breaks governance, breaks the audit trail.
|
|
196
|
+
2. **`advance_gate` without `sign_off`** — the gate stays "unsigned", the next agent does not understand what is ready.
|
|
197
|
+
3. **`apply_diff` without `git_commit`** — changes sit in the working tree, the next session loses them or claims them as its own.
|
|
198
|
+
4. **Manual SKILL.md parsing** instead of `get_skill` — you skip frontmatter validation and catch a latent bug (see the DEV-103 list_skills lesson).
|
|
199
|
+
5. **`report_exception` instead of an honest fix** — exception is for "the user decides next", not for "I worked around it".
|
|
200
|
+
6. **Calling MCP when the server is not registered** without a graceful fallback — silent failure is worse than an honest "MCP unavailable, fell back to file read".
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 9. DoD
|
|
205
|
+
|
|
206
|
+
- [ ] gate ritual fully completed (classify → action → submit → sign_off → advance)
|
|
207
|
+
- [ ] all artifacts submitted via `submit_artifact`
|
|
208
|
+
- [ ] all decisions recorded via `record_decision` (with `request_decision` where user approval is required)
|
|
209
|
+
- [ ] exceptions recorded honestly via `report_exception` (if any)
|
|
210
|
+
- [ ] `verify_claim` called for every DoD claim with an automated check
|
|
211
|
+
- [ ] commits with MCP-coupled changes are made in a single batch (apply_diff → git_commit)
|