archik 0.20.0 → 0.22.0
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/README.md +28 -5
- package/commands/accept.md +17 -1
- package/commands/bootstrap.md +13 -2
- package/commands/evolve.md +13 -0
- package/commands/migrate.md +25 -1
- package/commands/realize.md +92 -0
- package/commands/self-evolving.md +2 -1
- package/commands/spawn.md +32 -0
- package/commands/suggest.md +58 -12
- package/dist/cli/archik.mjs +568 -386
- package/dist/ui/assets/index-C3mFLYOG.js +228 -0
- package/dist/ui/assets/index-D6TFArum.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/templates/CLAUDE.md +44 -22
- package/package.json +1 -1
- package/skills/archik/SKILL.md +65 -9
- package/dist/ui/assets/index-Bn3qR7Cx.js +0 -223
- package/dist/ui/assets/index-DUgLHSFs.css +0 -1
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ Day to day:
|
|
|
70
70
|
| You type | You get |
|
|
71
71
|
| --- | --- |
|
|
72
72
|
| `/archik:suggest <feature>` | A staged diagram change, shown as a green/red diff on the canvas — accept or reject |
|
|
73
|
+
| `/archik:realize` | Make the code match the model the architect changed (works `archik gap` until empty) |
|
|
73
74
|
| `/archik:evolve [area]` | A proposed cleaner refactor, backed by drift and smells |
|
|
74
75
|
|
|
75
76
|
Already have docker-compose or Mermaid? Bootstrap from it instead of a blank canvas:
|
|
@@ -110,6 +111,23 @@ There are no coordinates — layout is computed by [ELK](https://eclipse.dev/elk
|
|
|
110
111
|
| --- | --- | --- |
|
|
111
112
|
| Structure | `.archik/main.archik.yaml` | Services, databases, queues, agents, LLMs, edges |
|
|
112
113
|
| Sub-architecture | `.archik/*.archik.yaml` | A node's internals, linked via `archikFile` |
|
|
114
|
+
| Decisions | `.archik/decisions/NNNN-*.md` | Why each accepted change was made — context, decision, alternatives, consequences |
|
|
115
|
+
|
|
116
|
+
**Steer by moving boxes.** The architect changes the architecture directly on the canvas — drag a node into another module (or out to the top level), draw or delete an edge, set a layer — and saves it with a short "why" (the decision record). A moved component becomes a *pending move*. `archik gap` (and the **Code gap** panel on the canvas) then lists exactly what the code must change: move or create code, remove or add imports, fix style breaks, finish nodes whose code landed. "Copy task for your agent" hands it to Claude Code as `/archik:realize`; the agent works the list until the code matches the model.
|
|
117
|
+
|
|
118
|
+
**Architecture style.** The architect picks the structure the code must follow — `layered`, `hexagonal`, `clean`, `modular-monolith` or `feature-slices` — with `style:` in the root file and a `layer:` on top-level nodes. archik enforces it on every change (validate, suggest set, canvas save reject a dependency that breaks it), draws the board in the style's lanes, and tells agents where each node sits and what it may depend on (`archik style`, `archik q describe`).
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
style:
|
|
122
|
+
kind: hexagonal # adapters → ports / core; the core never depends on an adapter
|
|
123
|
+
nodes:
|
|
124
|
+
- { id: rest-api, kind: module, name: REST API, layer: adapters, ... }
|
|
125
|
+
- { id: core, kind: module, name: Ordering core, layer: core, ... }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The diagram says *what*; decision records say *why*. Every staged change carries one under `metadata.suggestion.decision` — `suggest set` refuses a draft without it — and accepting the change writes it as a numbered markdown record with the node and edge changes listed as evidence. Records are never edited; a later decision that changes course lists the old numbers in `supersedes`.
|
|
129
|
+
|
|
130
|
+
Each change is also labelled by how hard it is to undo. A **one-way door** — a new data store, queue, external system, gateway, LLM or top-level module, a removal, or a boundary move — gets its own canvas review before the build plan; if it adds data, an outside system or public traffic, its record must say how it is secured, observed and rolled back. A **two-way door** goes through one combined review of model and plan.
|
|
113
131
|
|
|
114
132
|
Full schema: `npx archik schema`.
|
|
115
133
|
|
|
@@ -126,7 +144,7 @@ npx archik affected --since main # changed files → nodes → dependent
|
|
|
126
144
|
npx archik otel check --graph deps.json # edges vs a production service-dependency graph
|
|
127
145
|
```
|
|
128
146
|
|
|
129
|
-
`validate` proves the model is internally consistent, `drift` that it matches the code, and `otel check` that it matches production traffic. `smells` needs no model: it reports folder loops with the real imports as evidence (only relative imports are resolved, so every loop is real) and points at the cheapest import to cut. Gate every commit locally:
|
|
147
|
+
`validate` proves the model is internally consistent, `drift` that it matches the code, and `otel check` that it matches production traffic. `smells` needs no model: it reports folder loops with the real imports as evidence (only relative imports are resolved, so every loop is real) and points at the cheapest import to cut. On existing code, `archik smells --update-baseline` saves today's findings as known debt, so `--fail-on-warn` fails only on new loops and growing files. Gate every commit locally:
|
|
130
148
|
|
|
131
149
|
```bash
|
|
132
150
|
npx archik hooks install # pre-commit: archik validate
|
|
@@ -188,7 +206,7 @@ jobs:
|
|
|
188
206
|
- uses: actions/checkout@v4
|
|
189
207
|
- uses: bacharSalleh/archik@main
|
|
190
208
|
with:
|
|
191
|
-
smells-fail: true # optional gate;
|
|
209
|
+
smells-fail: true # optional gate; with a committed baseline, fails only on new smells
|
|
192
210
|
```
|
|
193
211
|
|
|
194
212
|
Inputs: `path`, `working-directory`, `validate`, `drift`, `smells-fail`, `compare-ref`, `comment`, `github-token`, `version`.
|
|
@@ -207,7 +225,9 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
207
225
|
| `archik dev` / `start` / `stop` / `status` | Live canvas lifecycle (foreground / detached) |
|
|
208
226
|
| `archik validate [path]` | Schema + cross-file + constraints (exit 1 on error) |
|
|
209
227
|
| `archik complexity [path]` | Flag over-large files, hub nodes, deep nesting (`--fail-on-warn` to gate) |
|
|
210
|
-
| `archik
|
|
228
|
+
| `archik gap` | What the code must change to match the model — move / create code, imports, style breaks, finish (`--json`, `--all`, `--fail-on-gap`) |
|
|
229
|
+
| `archik style [list]` | The architecture style: rule, layers / modules, where nodes sit, violations; `list` shows every style |
|
|
230
|
+
| `archik smells [dir]` | Folder import loops + oversized source files, from the code (`--max-file-lines`, `--fail-on-warn`, `--update-baseline`) |
|
|
211
231
|
| `archik render --out <svg>` | Headless SVG render (`--focus <id>`, `--hide-structural`) |
|
|
212
232
|
| `archik watch` | Re-render SVG on every change |
|
|
213
233
|
| `archik q <sub>` | Query: `describe` `deps` `dependents` `neighbors` `impact` `list` `edges` `stats` |
|
|
@@ -215,7 +235,7 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
215
235
|
| `archik affected` | Changed files → nodes, dependents, model files, unmapped (`--since <ref>`, `--files`) |
|
|
216
236
|
| `archik drift` | sourcePath gaps (`--edges` verifies edges vs the import graph) |
|
|
217
237
|
| `archik otel check --graph <f>` | Verify edges against a production service-dependency graph |
|
|
218
|
-
| `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` |
|
|
238
|
+
| `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` — accept writes the decision record to `.archik/decisions/` |
|
|
219
239
|
| `archik evolution <sub>` | Self-evolution loop: `enable` `reflect` `proposals` `approve` `reject` `report` |
|
|
220
240
|
| `archik patterns <sub>` | Pattern library: `list` `show <id>` `apply <id>` |
|
|
221
241
|
| `archik import compose\|mermaid [file]` | Bootstrap from docker-compose or a Mermaid flowchart |
|
|
@@ -224,7 +244,8 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
224
244
|
| `archik owners sync\|check` | Keep CODEOWNERS in step with node owners |
|
|
225
245
|
| `archik mcp` | MCP server over stdio for non-Claude-Code agents |
|
|
226
246
|
| `archik schema` | Print the document schema |
|
|
227
|
-
| `archik upgrade` | Upgrade + refresh installed skill/commands |
|
|
247
|
+
| `archik upgrade` | Upgrade + refresh installed skill/commands (`--migrate` also runs `archik migrate` with the new version) |
|
|
248
|
+
| `archik migrate` | Bring the project's archik files up to the installed version — archives first, validates after (`--dry-run`) |
|
|
228
249
|
|
|
229
250
|
Default file resolution: `.archik/main.archik.yaml`, falling back to the legacy `architecture.archik.yaml` (both present is an error).
|
|
230
251
|
|
|
@@ -238,7 +259,9 @@ Reach for archik when a project has more than a handful of components, ships wit
|
|
|
238
259
|
| AI-editor integration | **Skill + MCP** | None | None |
|
|
239
260
|
| Structural smells from code | **Yes** | No | No |
|
|
240
261
|
| Drift detection | **Yes** | No | No |
|
|
262
|
+
| Decision records tied to model changes | **Yes** | No | No |
|
|
241
263
|
| Governance constraints | **Yes** | No | No |
|
|
264
|
+
| Enforced architecture style (layered, hexagonal, clean, modular) | **Yes** | No | No |
|
|
242
265
|
| Validator | **Schema + cross-file + constraints** | Syntax only | Syntax only |
|
|
243
266
|
|
|
244
267
|
## Contributing
|
package/commands/accept.md
CHANGED
|
@@ -31,7 +31,14 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
31
31
|
|
|
32
32
|
3. **BUILD — plan (HITL).**
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
**Two-way door shortcut:** if `/archik:suggest` already showed the
|
|
35
|
+
build plan with this sidecar (two-way door), the accept you just
|
|
36
|
+
ran approved it — go straight to step 4. One-way doors always get
|
|
37
|
+
their own plan approval here.
|
|
38
|
+
|
|
39
|
+
Start from `npx archik gap --json` — it lists the code work the
|
|
40
|
+
accepted model now asks for (moves, new code, imports, style
|
|
41
|
+
breaks). Then translate the diagram delta into a numbered file-level
|
|
35
42
|
plan and present it for approval **before** touching code:
|
|
36
43
|
- Each new code-bearing node (`service`, `function`, `worker`,
|
|
37
44
|
`module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
|
|
@@ -42,6 +49,10 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
42
49
|
consumer handler; `writes` needs a repository method; etc).
|
|
43
50
|
- Any node still `status: proposed` → flag it; code must land
|
|
44
51
|
before flipping to `active`.
|
|
52
|
+
- If the accepted decision record has `crossCutting`, each
|
|
53
|
+
promise becomes a plan item: the security control, the signal
|
|
54
|
+
(log / metric / alert) and the rollback path (flag, revert,
|
|
55
|
+
migration down-step).
|
|
45
56
|
- Default to **tests-first** when behaviour is clearly bounded.
|
|
46
57
|
- If `superpowers:writing-plans` is available, use it; else
|
|
47
58
|
inline.
|
|
@@ -84,6 +95,11 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
84
95
|
Catches folder loops and oversized files, with the real imports
|
|
85
96
|
as evidence. A new loop is a gap — cut the cheapest import (or
|
|
86
97
|
queue a `/archik:suggest`) before declaring the milestone done.
|
|
98
|
+
With a committed baseline (`.archik/smells-baseline.json`) only
|
|
99
|
+
findings marked **NEW** count; known debt is not this change's job.
|
|
100
|
+
|
|
101
|
+
For a one-way door, confirm each `crossCutting` promise from the
|
|
102
|
+
decision record is in the code before flipping nodes to `active`.
|
|
87
103
|
`superpowers:verification-before-completion` when available.
|
|
88
104
|
If `docs/architecture.svg` is committed, regenerate it:
|
|
89
105
|
```
|
package/commands/bootstrap.md
CHANGED
|
@@ -64,8 +64,17 @@ brief and start the DESIGN loop.
|
|
|
64
64
|
> forces priorities into the open before any code lands. New
|
|
65
65
|
> nodes start `status: proposed` (the code doesn't exist on disk
|
|
66
66
|
> yet) and flip to `status: active` when the code lands in BUILD.
|
|
67
|
+
> Only the first milestone is modelled in detail; later areas stay
|
|
68
|
+
> coarse placeholders until their turn.
|
|
67
69
|
> The commitment lives in the YAML, not in the chat log."
|
|
68
|
-
5. When the brief lands,
|
|
70
|
+
5. When the brief lands, agree the **architecture style** first:
|
|
71
|
+
show `npx archik style list`, recommend one that fits the brief
|
|
72
|
+
(small service → layered; rich domain with many integrations →
|
|
73
|
+
hexagonal or clean; several teams in one deployable → modular
|
|
74
|
+
monolith; many independent features → feature slices), and ask
|
|
75
|
+
the user to pick. The first sidecar sets `style:` and puts each
|
|
76
|
+
top-level node in its layer or module.
|
|
77
|
+
6. Then run the standard DESIGN loop:
|
|
69
78
|
`/archik:suggest` (structural sidecar) → `/archik:accept` →
|
|
70
79
|
BUILD. Stop at each inline-review gate; don't barrel through.
|
|
71
80
|
|
|
@@ -91,7 +100,9 @@ diagram, then iterate from honest ground truth.
|
|
|
91
100
|
duplicate them here.
|
|
92
101
|
4. After the user accepts the spawn sidecar, suggest the natural
|
|
93
102
|
follow-up: "Want to check the code for structural smells?
|
|
94
|
-
`npx archik smells` finds folder loops and oversized files
|
|
103
|
+
`npx archik smells` finds folder loops and oversized files — and
|
|
104
|
+
`--update-baseline` saves today's findings so CI fails only on new
|
|
105
|
+
ones."
|
|
95
106
|
|
|
96
107
|
### C. `.archik/` exists but the diagram is empty or near-empty
|
|
97
108
|
|
package/commands/evolve.md
CHANGED
|
@@ -30,10 +30,16 @@ any file under `.archik/`.
|
|
|
30
30
|
|
|
31
31
|
2. **Ground yourself in the current shape** via the query CLI:
|
|
32
32
|
```
|
|
33
|
+
npx archik style
|
|
33
34
|
npx archik q stats
|
|
34
35
|
npx archik q list
|
|
35
36
|
npx archik q edges
|
|
36
37
|
```
|
|
38
|
+
If no style is declared, one of the best improvements you can
|
|
39
|
+
offer is to adopt one (`npx archik style list`): pick the style the
|
|
40
|
+
code is closest to, set it in the draft with layers on the
|
|
41
|
+
top-level nodes, and let the violations it reports become the
|
|
42
|
+
refactor plan.
|
|
37
43
|
If `$ARGUMENTS` names a specific area, also:
|
|
38
44
|
```
|
|
39
45
|
npx archik q describe <id>
|
|
@@ -107,6 +113,13 @@ any file under `.archik/`.
|
|
|
107
113
|
# full proposed end-state — every node, not just the delta
|
|
108
114
|
edges:
|
|
109
115
|
# ...
|
|
116
|
+
metadata:
|
|
117
|
+
suggestion:
|
|
118
|
+
decision:
|
|
119
|
+
context: <the smell and its evidence, e.g. the folder loop imports>
|
|
120
|
+
decision: <the refactor you chose>
|
|
121
|
+
alternatives: [<other fixes you weighed, incl. leaving it>]
|
|
122
|
+
consequences: <what gets easier and what it costs>
|
|
110
123
|
YAML
|
|
111
124
|
```
|
|
112
125
|
|
package/commands/migrate.md
CHANGED
|
@@ -4,7 +4,8 @@ description: Finish a migration — check the result and fix what the migrator f
|
|
|
4
4
|
|
|
5
5
|
# /archik:migrate — check what the deterministic migration did
|
|
6
6
|
|
|
7
|
-
`archik upgrade --migrate
|
|
7
|
+
`archik migrate` (or `archik upgrade --migrate`, which runs it through
|
|
8
|
+
the newly installed version) already ran the **deterministic** migration:
|
|
8
9
|
it archived the old project, ran each pending step, validated, and
|
|
9
10
|
advanced `.archik/.version`. The current steps are:
|
|
10
11
|
|
|
@@ -12,6 +13,9 @@ advanced `.archik/.version`. The current steps are:
|
|
|
12
13
|
`.archik/main.archik.yaml`.
|
|
13
14
|
- **#3** — strip retired node fields (`stereotype`, `seqFiles`) from the
|
|
14
15
|
model files.
|
|
16
|
+
- **#4** — move retired use-case, sequence, actor, alpha and trace files
|
|
17
|
+
to `.archik/retired/`, strip retired fields from pending suggestions,
|
|
18
|
+
and flag code, CI and scripts that still use removed features.
|
|
15
19
|
|
|
16
20
|
(#2, the old use-case back-fill, is retired and never runs.)
|
|
17
21
|
|
|
@@ -30,6 +34,23 @@ developer's only copy of the pre-migration project.
|
|
|
30
34
|
|
|
31
35
|
1. **Read the migrator's output.** Any `ⓘ` line it printed is a task for
|
|
32
36
|
you. If it printed none, the steps below are a quick check only.
|
|
37
|
+
The usual ones from 0.19 and older:
|
|
38
|
+
- **moved N retired files to `.archik/retired/`** — tell the user
|
|
39
|
+
they are kept only as history. Ask before deleting them. If a use
|
|
40
|
+
case explains *why* a structure exists, offer to capture that as a
|
|
41
|
+
decision record with the next `/archik:suggest` touching that area.
|
|
42
|
+
- **pending suggestion … has no decision record** — read it with
|
|
43
|
+
`npx archik suggest show`, then either re-stage it with a decision
|
|
44
|
+
record (`/archik:suggest`) or ask the user to reject it.
|
|
45
|
+
- **code imports `archik/trace`** — the recorder is gone. Remove the
|
|
46
|
+
`trace(...)` calls and the import from those test files; keep the
|
|
47
|
+
tests' real assertions. Run the tests afterwards.
|
|
48
|
+
- **workflow uses `trace-fail-on`** — replace it with
|
|
49
|
+
`smells-fail: true` (or drop it). On existing code, offer
|
|
50
|
+
`npx archik smells --update-baseline` first so CI fails only on
|
|
51
|
+
new smells.
|
|
52
|
+
- **package.json scripts call a removed command** — remove the
|
|
53
|
+
script or replace it (`archik smells`, `archik drift`).
|
|
33
54
|
|
|
34
55
|
2. **Find the archived original.**
|
|
35
56
|
```bash
|
|
@@ -47,6 +68,9 @@ developer's only copy of the pre-migration project.
|
|
|
47
68
|
npx archik drift
|
|
48
69
|
npx archik smells
|
|
49
70
|
```
|
|
71
|
+
If `validate` reports `unrecognized key … removed in archik 0.20`,
|
|
72
|
+
the migration did not run with the new version — run
|
|
73
|
+
`npx archik migrate` and check again.
|
|
50
74
|
|
|
51
75
|
4. **Fix gaps through the normal workflow.** If drift or the archive
|
|
52
76
|
shows structure the model misses (a node, an edge, a `parentId`
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Make the code match the architecture the architect changed
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /archik:realize — make the code match the model
|
|
6
|
+
|
|
7
|
+
The architect steers the architecture on the canvas: moves a box into
|
|
8
|
+
another module, draws or deletes an edge, sets a layer or a style. The
|
|
9
|
+
model changes first; the code has not caught up. Your job is to close
|
|
10
|
+
that gap — and only that gap.
|
|
11
|
+
|
|
12
|
+
`$ARGUMENTS` (optional) narrows the work to one node or area.
|
|
13
|
+
|
|
14
|
+
## CLI-only for architecture
|
|
15
|
+
|
|
16
|
+
Read the model only through `npx archik`. Change it only through
|
|
17
|
+
`npx archik suggest set` (the lifecycle flips below). Never edit
|
|
18
|
+
`.archik/*.yaml` by hand.
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
1. **Get the work list.**
|
|
23
|
+
```bash
|
|
24
|
+
npx archik gap --json
|
|
25
|
+
```
|
|
26
|
+
Each task has a `type` and a `text`:
|
|
27
|
+
- `move-code` — move the node's code from `from` to `to`, then fix
|
|
28
|
+
every import that pointed at the old path.
|
|
29
|
+
- `create-code` — create the code for a planned node at `path`.
|
|
30
|
+
- `style-break` — an import breaks the architecture style. Fix it
|
|
31
|
+
the way the message says (usually: add an interface / port in the
|
|
32
|
+
inner layer and depend on that).
|
|
33
|
+
- `remove-import` — the architect deleted that edge. Remove the
|
|
34
|
+
import (move the logic, or call through an allowed node).
|
|
35
|
+
- `add-dependency` — the model says A uses B; wire the import.
|
|
36
|
+
- `finish` — the node's code now exists; flip it to `active`.
|
|
37
|
+
|
|
38
|
+
If the list is empty, say so and stop.
|
|
39
|
+
|
|
40
|
+
2. **Read why.** For each node in the list, read the newest decision
|
|
41
|
+
record that mentions it in `.archik/decisions/` (plain markdown —
|
|
42
|
+
read it directly). Keep to the intent: a move into `billing` means
|
|
43
|
+
the code now belongs to billing, not just a new folder name.
|
|
44
|
+
|
|
45
|
+
3. **Check the rules before you edit.**
|
|
46
|
+
```bash
|
|
47
|
+
npx archik style
|
|
48
|
+
npx archik q describe <id> # the "style:" line: layer / module, may depend on
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. **Plan, then wait for "approve".** A numbered, file-level plan:
|
|
52
|
+
which folders move, which imports change, which files are created.
|
|
53
|
+
Keep it to the gap. No drive-by refactors.
|
|
54
|
+
|
|
55
|
+
5. **Do it in small commits.** Move with `git mv` so history follows
|
|
56
|
+
the code. After each step run the project's tests and typecheck.
|
|
57
|
+
|
|
58
|
+
6. **Flip finished nodes to active.** When `gap` lists `finish`
|
|
59
|
+
tasks, stage one sidecar that removes `status: proposed` from those
|
|
60
|
+
nodes, with a short decision record (context: the code landed;
|
|
61
|
+
decision: mark it active; alternative: keep it proposed until
|
|
62
|
+
deploy; consequence: drift now checks it):
|
|
63
|
+
```bash
|
|
64
|
+
npx archik suggest set --note "<nodes> are built" - <<'YAML'
|
|
65
|
+
... full document, those nodes without status: proposed ...
|
|
66
|
+
metadata:
|
|
67
|
+
suggestion:
|
|
68
|
+
decision: { context: ..., decision: ..., alternatives: [...], consequences: ... }
|
|
69
|
+
YAML
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
7. **Verify — the gap must be empty.**
|
|
73
|
+
```bash
|
|
74
|
+
npx archik gap # ✓ the code matches the model
|
|
75
|
+
npx archik validate
|
|
76
|
+
npx archik drift
|
|
77
|
+
npx archik smells # no NEW folder loops
|
|
78
|
+
```
|
|
79
|
+
Plus the project's tests, lint and build.
|
|
80
|
+
|
|
81
|
+
## If the model is wrong
|
|
82
|
+
|
|
83
|
+
If moving the code shows the architect's change cannot work (a cycle,
|
|
84
|
+
a missing port, a hidden caller), STOP. Explain what you found with the
|
|
85
|
+
file evidence, and propose the fix with `/archik:suggest` — don't bend
|
|
86
|
+
the code around the model, and don't change the model silently.
|
|
87
|
+
|
|
88
|
+
## Done when
|
|
89
|
+
|
|
90
|
+
`npx archik gap` prints "the code matches the model", tests pass, and
|
|
91
|
+
the finished nodes are `active`. End with one line on what changed and
|
|
92
|
+
the next step.
|
|
@@ -55,7 +55,8 @@ Never `Read`/`Write`/`Edit` files under `.archik/`.
|
|
|
55
55
|
(stages the blueprint as `status: proposed` nodes), then refine
|
|
56
56
|
ids/names with a follow-up `suggest set`.
|
|
57
57
|
- Tailored: author the full end-state and stage via
|
|
58
|
-
`npx archik suggest set --note '…' - <<'YAML' … YAML
|
|
58
|
+
`npx archik suggest set --note '…' - <<'YAML' … YAML`, with a
|
|
59
|
+
decision record under `metadata.suggestion.decision` (required).
|
|
59
60
|
|
|
60
61
|
6. **Wire the tests.** Name one test per loop step: "corrections are
|
|
61
62
|
recorded", "insights become proposals", "approved change applies".
|
package/commands/spawn.md
CHANGED
|
@@ -155,6 +155,13 @@ archik suggest set` stages it.
|
|
|
155
155
|
name: <Id> Internals
|
|
156
156
|
nodes: [ ... ]
|
|
157
157
|
edges: [ ... ]
|
|
158
|
+
metadata:
|
|
159
|
+
suggestion:
|
|
160
|
+
decision:
|
|
161
|
+
context: <why this split is needed>
|
|
162
|
+
decision: <what you chose>
|
|
163
|
+
alternatives: [<option not chosen>]
|
|
164
|
+
consequences: <what gets easier and harder>
|
|
158
165
|
YAML
|
|
159
166
|
# mechanical: puts sub-file on disk so the main draft's
|
|
160
167
|
# archikFile: pointer validates. NOT the user's review gate
|
|
@@ -191,9 +198,21 @@ archik suggest set` stages it.
|
|
|
191
198
|
# full proposed end-state, with archikFile pointers
|
|
192
199
|
edges:
|
|
193
200
|
# ...
|
|
201
|
+
metadata:
|
|
202
|
+
suggestion:
|
|
203
|
+
decision:
|
|
204
|
+
context: <what the source tree shows and why it is split this way>
|
|
205
|
+
decision: <what you chose>
|
|
206
|
+
alternatives: [<option not chosen>]
|
|
207
|
+
consequences: <what gets easier and harder>
|
|
194
208
|
YAML
|
|
195
209
|
```
|
|
196
210
|
|
|
211
|
+
Every draft needs its decision record — `suggest set` refuses
|
|
212
|
+
one without it. For a spawn, the context is what the source
|
|
213
|
+
tree shows; the alternatives are other ways to cut it (one
|
|
214
|
+
flat file, a different grouping).
|
|
215
|
+
|
|
197
216
|
c. If `suggest set` reports validation errors, re-run with the
|
|
198
217
|
corrected YAML. Never edit the sidecar by hand.
|
|
199
218
|
|
|
@@ -204,6 +223,13 @@ archik suggest set` stages it.
|
|
|
204
223
|
- "Looks wrong? Run `/archik:reject` and we'll iterate. Or run
|
|
205
224
|
`/archik:evolve` after accepting if you want a cleaner
|
|
206
225
|
bounded-context version."
|
|
226
|
+
- Offer an **architecture style** next: name the style the code is
|
|
227
|
+
closest to (`npx archik style list` — e.g. `controllers/`,
|
|
228
|
+
`services/`, `repositories/` folders → layered; `ports/` +
|
|
229
|
+
`adapters/` → hexagonal; one folder per feature → feature
|
|
230
|
+
slices) and offer to stage it with layers on the top-level
|
|
231
|
+
nodes. Spawn itself stays descriptive — don't add the style in
|
|
232
|
+
the spawn draft.
|
|
207
233
|
|
|
208
234
|
**Offer a smells check at the end of this step** (not after
|
|
209
235
|
accept — you won't be there). Run it now so the offer is concrete:
|
|
@@ -215,6 +241,12 @@ archik suggest set` stages it.
|
|
|
215
241
|
`<a>` and `<b>`? The cheapest cut is `<file imports "specifier">`."*
|
|
216
242
|
If it finds none, skip this line.
|
|
217
243
|
|
|
244
|
+
Existing code almost always has some debt. Also offer the
|
|
245
|
+
baseline so CI can gate on *new* smells from now on: *"Want me to
|
|
246
|
+
save today's findings as the baseline (`npx archik smells
|
|
247
|
+
--update-baseline`, commit `.archik/smells-baseline.json`)? Then
|
|
248
|
+
`--fail-on-warn` only fails on new loops or growing files."*
|
|
249
|
+
|
|
218
250
|
Do NOT fix smells here — spawn is descriptive, and the fix is a
|
|
219
251
|
separate ask from the user. This note is a prompt, not an action.
|
|
220
252
|
|
package/commands/suggest.md
CHANGED
|
@@ -26,7 +26,7 @@ the contract with the user.
|
|
|
26
26
|
|
|
27
27
|
The skill defines a 5-phase loop: **Discover → Design → Decide → Build
|
|
28
28
|
→ Verify**. This command covers Discover (grounding) and Design
|
|
29
|
-
(staging the sidecar with
|
|
29
|
+
(staging the sidecar with its decision record), then hands off to the user's
|
|
30
30
|
review and the explicit Decide gate (`/archik:accept` or
|
|
31
31
|
`/archik:reject`). Don't skip clarification just because a slash
|
|
32
32
|
command was typed — clarification is what makes the draft good. Don't
|
|
@@ -66,11 +66,21 @@ start Build phase here; that's gated on accept.
|
|
|
66
66
|
2. **Ground yourself in the current models** using the query CLI
|
|
67
67
|
(do not `cat` the YAML):
|
|
68
68
|
```
|
|
69
|
+
npx archik style
|
|
69
70
|
npx archik q stats
|
|
70
71
|
npx archik q list
|
|
71
72
|
```
|
|
72
73
|
If `$ARGUMENTS` mentions a specific node by name, also run
|
|
73
|
-
`npx archik q describe <id>` for it
|
|
74
|
+
`npx archik q describe <id>` for it (its `style:` line says which
|
|
75
|
+
layer or module it sits in and what it may depend on).
|
|
76
|
+
|
|
77
|
+
If the model declares a style, the draft must follow it: give each
|
|
78
|
+
new top-level node its `layer` (layered, hexagonal, clean) or put
|
|
79
|
+
it in the right module (modular monolith, feature slices), and keep
|
|
80
|
+
every new edge inside the style's rule. `suggest set` rejects a
|
|
81
|
+
draft that breaks it. If the feature truly needs a forbidden
|
|
82
|
+
dependency, stop and ask the user — the fix is usually a port /
|
|
83
|
+
interface, not an exception.
|
|
74
84
|
|
|
75
85
|
3. **Lock in the schema.** Run this before drafting any YAML —
|
|
76
86
|
the prose in this file describes the workflow, not the field
|
|
@@ -113,23 +123,51 @@ start Build phase here; that's gated on accept.
|
|
|
113
123
|
# full proposed end-state — every node, not just the delta
|
|
114
124
|
edges:
|
|
115
125
|
# full proposed end-state — every edge, not just the delta
|
|
126
|
+
metadata:
|
|
127
|
+
suggestion:
|
|
128
|
+
decision:
|
|
129
|
+
context: <the problem and the forces — facts, not the solution>
|
|
130
|
+
decision: <what you chose, 1–2 sentences>
|
|
131
|
+
alternatives:
|
|
132
|
+
- <a real option you weighed and did not choose>
|
|
133
|
+
consequences: <what gets easier AND what gets harder>
|
|
134
|
+
# crossCutting: # REQUIRED when the change adds data, an
|
|
135
|
+
# security: ... # outside system or public traffic
|
|
136
|
+
# observability: ...
|
|
137
|
+
# rollback: ...
|
|
138
|
+
# supersedes: ["0003"] # only when this reverses an earlier record
|
|
116
139
|
YAML
|
|
117
140
|
```
|
|
118
141
|
|
|
142
|
+
The decision record is required — `suggest set` refuses a draft
|
|
143
|
+
without it, and accept writes it to
|
|
144
|
+
`.archik/decisions/NNNN-<slug>.md`. Before writing it, read the
|
|
145
|
+
past records for the area (`ls .archik/decisions/`, they are plain
|
|
146
|
+
markdown). If your change reverses one, list it in `supersedes`.
|
|
147
|
+
|
|
148
|
+
`suggest set` prints whether the change is a **one-way door** (hard
|
|
149
|
+
to undo: a new data store, queue/stream, external system,
|
|
150
|
+
gateway/auth/cdn, cloud or LLM node, a new edge to an external
|
|
151
|
+
system, a new top-level module, a removal, a boundary move) or a
|
|
152
|
+
**two-way door**. If it adds data, an outside system or public
|
|
153
|
+
traffic it refuses the draft until `crossCutting` says how it is
|
|
154
|
+
**secured** (who can reach it, secrets, data exposure),
|
|
155
|
+
**observed** (the signal that shows it working or failing) and
|
|
156
|
+
**rolled back** (how to undo it safely). Write real answers, not
|
|
157
|
+
placeholders — the plan must later land what you promise here.
|
|
158
|
+
|
|
119
159
|
If the command exits non-zero, re-run with the corrected YAML.
|
|
120
160
|
Never write a draft file under `.archik/` and never edit the
|
|
121
161
|
sidecar directly.
|
|
122
162
|
|
|
123
|
-
5. **
|
|
124
|
-
handing off to review
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
- **
|
|
131
|
-
should default to async).
|
|
132
|
-
- Any **alternative you rejected** and the trade-off.
|
|
163
|
+
5. **Summarise the decision record** in 2–4 short bullets before
|
|
164
|
+
handing off to review — the same content the record holds, so the
|
|
165
|
+
user can judge the *why* next to the diagram (the canvas also shows
|
|
166
|
+
it under **Why** on the review banner). Make sure it covers:
|
|
167
|
+
- Which **boundaries** the change touches and why those boundaries.
|
|
168
|
+
- What each new node owns and why it is its own node.
|
|
169
|
+
- **Async vs sync** choice and the reason.
|
|
170
|
+
- The **alternatives** you rejected and what the choice costs.
|
|
133
171
|
|
|
134
172
|
Keep it tight — bullets, not paragraphs. The diagram does the rest.
|
|
135
173
|
|
|
@@ -141,6 +179,14 @@ start Build phase here; that's gated on accept.
|
|
|
141
179
|
**reject** and tell me what didn't fit (boundary? relationship?
|
|
142
180
|
scope? naming? composition? lifecycle?) so I can revise."
|
|
143
181
|
|
|
182
|
+
Match the gate to the door:
|
|
183
|
+
- **One-way door** — say so ("This is hard to undo: <reasons>")
|
|
184
|
+
and hand off the sidecar alone. The build plan comes after
|
|
185
|
+
accept, as its own approval gate.
|
|
186
|
+
- **Two-way door** — include the numbered build plan in this same
|
|
187
|
+
hand-off, and say that `/archik:accept` approves both the model
|
|
188
|
+
change and the plan.
|
|
189
|
+
|
|
144
190
|
Do NOT pre-emptively start implementing. Wait for `/archik:accept`.
|
|
145
191
|
|
|
146
192
|
## Notes
|