archik 0.20.0 → 0.21.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 +12 -5
- package/commands/accept.md +14 -0
- package/commands/bootstrap.md +5 -1
- package/commands/evolve.md +7 -0
- package/commands/migrate.md +25 -1
- package/commands/self-evolving.md +2 -1
- package/commands/spawn.md +25 -0
- package/commands/suggest.md +47 -11
- package/dist/cli/archik.mjs +434 -345
- package/dist/ui/assets/index-B9OpuGHk.js +226 -0
- package/dist/ui/index.html +1 -1
- package/docs/templates/CLAUDE.md +35 -19
- package/package.json +1 -1
- package/skills/archik/SKILL.md +54 -9
- package/dist/ui/assets/index-Bn3qR7Cx.js +0 -223
package/dist/ui/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
} catch {}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-B9OpuGHk.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-DUgLHSFs.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/docs/templates/CLAUDE.md
CHANGED
|
@@ -8,13 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
I move from **brief → structural model → build plan → code**. Each step is a reviewable artifact, gated by a HITL accept before the next one is produced. If implementation invalidates the model, I stop coding and fix the model first.
|
|
10
10
|
|
|
11
|
-
The **structural model** (archik diagram — nodes, nesting via `parentId` and sub-files, edges) says *what exists* and *which way dependencies flow*. `archik drift` and `archik smells` check it against the real code. Code is the last artifact, not the first.
|
|
11
|
+
The **structural model** (archik diagram — nodes, nesting via `parentId` and sub-files, edges) says *what exists* and *which way dependencies flow*. **Decision records** in `.archik/decisions/` say *why* it is shaped that way — one per accepted change. `archik drift` and `archik smells` check it against the real code. Code is the last artifact, not the first.
|
|
12
12
|
|
|
13
13
|
Two gate types:
|
|
14
14
|
|
|
15
15
|
- **Canvas gate** — `/archik:accept` on the rendered diff. Used for the structural sidecar.
|
|
16
16
|
- **Plan gate** — user replies "approve". Used for the build plan before any code edits.
|
|
17
17
|
|
|
18
|
+
### Match gates to reversibility
|
|
19
|
+
|
|
20
|
+
`archik suggest set` labels every change a **one-way door** (hard to undo) or a **two-way door** (easy to undo):
|
|
21
|
+
|
|
22
|
+
- **One-way door** — adds a data store, queue/stream, external system, gateway/auth/cdn, cloud or LLM node, a new edge to an external system, a top-level module; or removes a built node or moves one to another parent. Two separate stops: canvas gate first, then the plan gate. If it adds data, an outside system or public traffic, the decision record must also say how it is **secured, observed and rolled back** (`crossCutting`) — `suggest set` refuses it otherwise.
|
|
23
|
+
- **Two-way door** — everything else (an internal function, a new edge inside a module, a description, a lifecycle flip). One stop: stage the sidecar and show the build plan in the same message; `/archik:accept` approves both.
|
|
24
|
+
|
|
18
25
|
### Match ritual to scope
|
|
19
26
|
|
|
20
27
|
Not every task needs the full loop. Skip the modeling phases and just edit when the change is:
|
|
@@ -30,8 +37,8 @@ Run the loop when the change introduces new behavior, a new structural shape, or
|
|
|
30
37
|
**DISCOVER → DESIGN → DECIDE → BUILD → VERIFY**, with one critical back-edge: if BUILD reveals the model is wrong, stop coding and loop back to DESIGN.
|
|
31
38
|
|
|
32
39
|
- **DISCOVER** — `npx archik q stats / list`, `npx archik smells`, `ls` source dirs. Read before write.
|
|
33
|
-
- **DESIGN** — structural sidecar
|
|
34
|
-
- **DECIDE** — `/archik:accept` on the structural sidecar.
|
|
40
|
+
- **DESIGN** — structural sidecar plus its decision record (context, decision, alternatives, consequences).
|
|
41
|
+
- **DECIDE** — `/archik:accept` on the structural sidecar. Accept writes the decision record.
|
|
35
42
|
- **BUILD** — numbered plan → "approve" → execute in small commits. Tests-first when the behavior is clearly bounded.
|
|
36
43
|
- **VERIFY** — validate, tests, lint, build, `archik drift`, `archik smells`, eyeball UI. Stage the `proposed → active` flip.
|
|
37
44
|
|
|
@@ -45,7 +52,7 @@ I'd run the loop like this:
|
|
|
45
52
|
|
|
46
53
|
1. **DISCOVER** — `npx archik q list`, `npx archik q describe auth-service`, peek at `src/auth/`. Find that an `auth-service` node already handles login.
|
|
47
54
|
|
|
48
|
-
2. **DESIGN** — `npx archik suggest set` adding two `proposed` nodes under the `auth` module: a `reset-handler` and an `email-sender` that talks to the email provider (modelled as `external`). Two new edges: `reset-handler → email-sender (calls)`, `reset-handler → auth-service (writes)`. Dependencies flow one way — nothing in `auth-service` imports the handler. Wait for **`/archik:accept`** on the canvas.
|
|
55
|
+
2. **DESIGN** — `npx archik suggest set` adding two `proposed` nodes under the `auth` module: a `reset-handler` and an `email-sender` that talks to the email provider (modelled as `external`). Two new edges: `reset-handler → email-sender (calls)`, `reset-handler → auth-service (writes)`. Dependencies flow one way — nothing in `auth-service` imports the handler. The draft's decision record: *context* — users who lose their password open support tickets; *decision* — self-service reset by emailed one-time link; *alternatives* — admin-only reset, SMS codes; *consequences* — we now depend on an email provider and must expire tokens. It adds an external system, so `suggest set` calls it a **one-way door** and the record also needs *crossCutting*: tokens are single-use and expire in 15 minutes, the provider key lives in the secret store (security); reset requests and send failures are counted and alerted (observability); a feature flag turns the reset link off (rollback). Wait for **`/archik:accept`** on the canvas; accept writes `.archik/decisions/0004-password-reset-by-email.md`.
|
|
49
56
|
|
|
50
57
|
3. **BUILD plan** — `src/auth/resetHandler.ts` (request + verify), `src/auth/emailSender.ts` (provider client), `tests/auth/reset.happy.spec.ts`, `tests/auth/reset.expired.spec.ts`. Each new edge maps to a real call. Out of scope: rate limiting (next milestone). Wait for "approve".
|
|
51
58
|
|
|
@@ -70,40 +77,42 @@ The recommended opener is **`/archik:bootstrap`** (with or without an inline bri
|
|
|
70
77
|
|
|
71
78
|
3. **Surface genuine ambiguities** — usually 2–4 questions about scope, target users, hard constraints, or non-obvious tradeoffs. Skip questions whose answers are in the brief.
|
|
72
79
|
|
|
73
|
-
4. **Stage the structural model** via `npx archik suggest set` — every node
|
|
80
|
+
4. **Stage the structural model** via `npx archik suggest set` — the **first milestone in detail** (every node and edge it needs, `status: proposed`), and the rest of the system as a few coarse `module` placeholders (one per later area, `status: proposed`, one-line description). Wait for **`/archik:accept`** on the canvas (formal gate).
|
|
74
81
|
|
|
75
|
-
5. **
|
|
82
|
+
5. **Detail grows with the work.** Don't model what you can't yet know. Each milestone first details its own area (a sidecar that replaces the placeholder's insides), then flips those nodes from `proposed` to `active` (with `sourcePath`) as code lands. The set of nodes a milestone flips IS the milestone.
|
|
76
83
|
|
|
77
84
|
## Per-milestone rhythm
|
|
78
85
|
|
|
79
|
-
Every milestone follows the same shape. Two gate types apply — **canvas gate** (`/archik:accept`) and **plan gate** ("approve"):
|
|
86
|
+
Every milestone follows the same shape. Two gate types apply — **canvas gate** (`/archik:accept`) and **plan gate** ("approve") — merged into one stop for two-way doors:
|
|
80
87
|
|
|
81
|
-
1. **Structural sidecar** — `/archik:suggest <feature>`. Stages the proposed end-state for this milestone via `npx archik suggest set` under the hood.
|
|
88
|
+
1. **Structural sidecar** — `/archik:suggest <feature>`. Stages the proposed end-state for this milestone via `npx archik suggest set` under the hood, with its decision record. Note whether `suggest set` called it a one-way or two-way door.
|
|
82
89
|
2. **`/archik:accept` on the structural diagram** — formal canvas gate.
|
|
83
|
-
3. **BUILD plan** — one-line goal, deps, files with paths and signatures, non-obvious bits, acceptance gate, out-of-scope items, the `proposed → active` flip this milestone will produce. Each new edge must map to a real call in the plan.
|
|
84
|
-
4. **"approve" on the plan** — plan gate. Don't start editing files until approved.
|
|
90
|
+
3. **BUILD plan** — one-line goal, deps, files with paths and signatures, non-obvious bits, acceptance gate, out-of-scope items, the `proposed → active` flip this milestone will produce. Each new edge must map to a real call in the plan. For a one-way door with `crossCutting`, the plan also lands what it promised: the security control, the signal you will watch, the rollback path.
|
|
91
|
+
4. **"approve" on the plan** — plan gate. Don't start editing files until approved. *Two-way door:* steps 1–4 collapse — show the plan together with the sidecar, and `/archik:accept` approves both.
|
|
85
92
|
5. **Execute** — small commits, narrate non-obvious decisions, declare back-edges to DESIGN openly when they happen.
|
|
86
|
-
6. **Verify** — project tests → lint → build → `npx archik drift` → `npx archik smells` → aesthetic eyeball (if UI). No new folder loop should close the milestone.
|
|
87
|
-
7. **Stage the `proposed → active` sidecar** — `/archik:suggest "flip <list> to active"`. Flips nodes/edges with their `sourcePath` now on disk.
|
|
93
|
+
6. **Verify** — project tests → lint → build → `npx archik drift` → `npx archik smells` → aesthetic eyeball (if UI). No **new** folder loop or oversized file should close the milestone (with a committed baseline, `smells` marks them NEW). For a one-way door, check the `crossCutting` promises exist in the code before the flip to `active`.
|
|
94
|
+
7. **Stage the `proposed → active` sidecar** — `/archik:suggest "flip <list> to active"`. Flips nodes/edges with their `sourcePath` now on disk. Its decision record is short: what landed, and that drift now checks it.
|
|
88
95
|
8. **Hand off** — list what to eyeball; wait for `/archik:accept` and (if there's a deploy) confirm deploy is green.
|
|
89
96
|
9. **Commit + push** — only after the user confirms.
|
|
90
97
|
|
|
91
98
|
## Hard rules
|
|
92
99
|
|
|
93
100
|
1. **Structure → plan → code. In that order.** The accepted diagram defines what to build. Code lands last.
|
|
94
|
-
2. **
|
|
101
|
+
2. **Gates match reversibility.** One-way doors get two stops: a **canvas gate** (`/archik:accept`) on the model, then an **approval gate** ("approve") on the plan. Two-way doors get one stop: sidecar and plan shown together, one `/archik:accept`. Never skip review of a one-way door to save time.
|
|
95
102
|
3. **Dependencies flow one way.** Sibling folders must not import each other. `npx archik smells` reports folder loops with the real imports as evidence — fix them, don't invent labels for them.
|
|
96
103
|
4. **Stop at every milestone boundary.** Summarize what shipped, run verifications (`archik drift` and `archik smells`), ask for the visual ack before continuing.
|
|
97
104
|
5. **Boring underneath.** No experimental framework features unless explicitly requested. Match the stack the brief specifies.
|
|
98
105
|
6. **No scope creep.** Out-of-scope items go in `FUTURE.md`, not the current milestone.
|
|
99
106
|
7. **Back-edge from BUILD lands on the model.** If implementation reveals the structural model is wrong, fix it with a fresh sidecar. Never paper over.
|
|
100
|
-
8. **
|
|
107
|
+
8. **Every structural change says why.** Each sidecar carries a decision record; accept writes it to `.archik/decisions/`. Records are never edited — to change course, a new record lists the old numbers in `supersedes`.
|
|
108
|
+
9. **Don't add comments that restate code.** Add a comment only when the WHY is non-obvious.
|
|
101
109
|
|
|
102
110
|
## What each phase produces
|
|
103
111
|
|
|
104
112
|
### DISCOVER
|
|
105
113
|
- `npx archik q stats` and `npx archik q list` to ground in the current diagram.
|
|
106
114
|
- `npx archik smells` to see folder loops and oversized files in the code.
|
|
115
|
+
- Past decision records in `.archik/decisions/` for the area you will touch — don't undo a choice without knowing why it was made.
|
|
107
116
|
- `ls -F` of relevant source dirs.
|
|
108
117
|
- A mental map of what exists vs what the request needs.
|
|
109
118
|
- No code, no diagram changes yet.
|
|
@@ -112,6 +121,9 @@ Every milestone follows the same shape. Two gate types apply — **canvas gate**
|
|
|
112
121
|
- One-line intent.
|
|
113
122
|
- 1–3 clarifying questions only when there's genuine ambiguity.
|
|
114
123
|
- A sidecar staged via `npx archik suggest set --note "..."` containing the **full proposed end-state**.
|
|
124
|
+
- A decision record in the draft (`metadata.suggestion.decision`): **context** (the problem and forces, not the solution), **decision**, **alternatives** (at least one real option not chosen), **consequences** (what gets easier *and* harder). `suggest set` refuses a draft without it.
|
|
125
|
+
- For changes that add data, an outside system or public traffic: `crossCutting` with **security** (who can reach it, secrets, data exposure), **observability** (how you will see it work or fail) and **rollback** (how to undo it safely).
|
|
126
|
+
- Model only what this milestone needs in detail; later areas stay coarse placeholders.
|
|
115
127
|
- New code-bearing nodes use `status: proposed` and may omit `sourcePath`.
|
|
116
128
|
- Containers via `parentId`; a big subsystem gets its own sub-file via `archikFile`.
|
|
117
129
|
- `description` on every node explains *what it does*, not *what kind it is*.
|
|
@@ -120,6 +132,7 @@ Every milestone follows the same shape. Two gate types apply — **canvas gate**
|
|
|
120
132
|
|
|
121
133
|
### DECIDE
|
|
122
134
|
- The user runs `/archik:accept` (apply) or `/archik:reject` (with a reason).
|
|
135
|
+
- On accept: the decision record lands in `.archik/decisions/NNNN-<slug>.md`, with the model change listed as evidence.
|
|
123
136
|
- On reject: ask one specific question pinned to one axis — boundary / relationship / scope / naming / composition / lifecycle. Treat the answer as a hard constraint, re-stage. Never silently retry the same draft.
|
|
124
137
|
|
|
125
138
|
### BUILD
|
|
@@ -137,10 +150,11 @@ Every milestone follows the same shape. Two gate types apply — **canvas gate**
|
|
|
137
150
|
3. Build / typecheck — clean.
|
|
138
151
|
4. `npx archik validate` — schema + cross-file + constraint checks clean.
|
|
139
152
|
5. `npx archik drift` — structural model matches disk.
|
|
140
|
-
6. `npx archik smells` — no new folder loops or oversized files. `--fail-on-warn`
|
|
141
|
-
7.
|
|
142
|
-
8.
|
|
143
|
-
9.
|
|
153
|
+
6. `npx archik smells` — no **new** folder loops or oversized files. On existing code, run `npx archik smells --update-baseline` once and commit `.archik/smells-baseline.json`; `--fail-on-warn` then fails CI only on new findings. Tighten the baseline when findings are fixed.
|
|
154
|
+
7. For one-way doors: the record's `crossCutting` promises (security control, signal, rollback path) exist in the code.
|
|
155
|
+
8. Aesthetic eyeball when there's a UI — share a screenshot, ask before declaring done.
|
|
156
|
+
9. Stage the `proposed → active` sidecar — flip nodes/edges with `sourcePath`.
|
|
157
|
+
10. Commit (with a Co-Authored-By line) and push — only after user confirms.
|
|
144
158
|
|
|
145
159
|
## Archik commands I use
|
|
146
160
|
|
|
@@ -154,7 +168,7 @@ Every milestone follows the same shape. Two gate types apply — **canvas gate**
|
|
|
154
168
|
- `npx archik suggest set --note "<one-liner>" - <<'YAML' ... YAML` — stage a structural sidecar (full document).
|
|
155
169
|
|
|
156
170
|
**Lifecycle:**
|
|
157
|
-
- `npx archik suggest accept | reject | show` — structural sidecar lifecycle.
|
|
171
|
+
- `npx archik suggest accept | reject | show` — structural sidecar lifecycle. Accept writes the decision record.
|
|
158
172
|
- `npx archik validate` — schema + cross-file + constraint checks.
|
|
159
173
|
|
|
160
174
|
**Verification & rendering:**
|
|
@@ -167,6 +181,8 @@ Every milestone follows the same shape. Two gate types apply — **canvas gate**
|
|
|
167
181
|
- **Editing `.archik/main.archik.yaml` by hand** — forbidden; always go through `suggest set`.
|
|
168
182
|
- **Writing prose-only summaries instead of staging a sidecar** — every structural change must produce a reviewable artifact.
|
|
169
183
|
- **Skipping the BUILD-plan HITL** — diagram acceptance is not implicit code approval.
|
|
184
|
+
- **A decision record with only upsides** — consequences must name what gets harder too; alternatives must be options you really weighed.
|
|
185
|
+
- **Editing an old decision record** — records are history. Stage a new decision that `supersedes` it.
|
|
170
186
|
- **Renaming an `id` mid-flow** — forbidden; remove the old and add a new one. Renames break diff and require manual re-link in code.
|
|
171
187
|
- **Labelling a smell without evidence** — name a folder loop by the imports `archik smells` shows, not by a made-up category.
|
|
172
188
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "archik",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams with a live browser canvas, headless SVG render in CI, and an installable Claude skill so the model treats the diagram as the spec.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"architecture",
|
package/skills/archik/SKILL.md
CHANGED
|
@@ -9,6 +9,7 @@ description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml e
|
|
|
9
9
|
|
|
10
10
|
- **The YAML is the source of truth.** `.archik/main.archik.yaml` (and any `*.archik.yaml` sub-files) describe the system the user is building. The browser canvas is just a stateless projection of that file.
|
|
11
11
|
- **The CLI is your only interface to it.** You never read, write, or edit archik files directly. Every read goes through `npx archik q ...`; every write goes through `npx archik suggest set` → user accepts via `/archik:accept`.
|
|
12
|
+
- **Every change says why.** A draft carries a short decision record (context, decision, alternatives, consequences). Accept writes it to `.archik/decisions/NNNN-<slug>.md`. The diagram is the *what*; the records are the *why*. Read past records before you change a structure they explain — they are plain markdown, so reading them directly is fine (the "CLI only" rule is about the YAML model files).
|
|
12
13
|
- **Two command surfaces:** the user types `/archik:*` slash commands; you run `npx archik ...` directly. They're not interchangeable — see the tables below.
|
|
13
14
|
- **One change to ship, not the whole system.** When a user hands you a brief on a fresh project, never say "let me sketch your whole system." Propose the smallest structure that delivers the first piece of value. New code-bearing nodes start `status: proposed` (the code doesn't exist on disk yet) and flip to `status: active` when the code lands in BUILD. The project's commitments live in the YAML, not in the chat log.
|
|
14
15
|
- **Read the learned overlay at session start.** If `.archik/evolution/learned.md` exists, read it (with the Read tool — it is docs, not an archik YAML) before your first archik action and treat every note as binding guidance. Each note is a lesson this project's evolution loop gathered from real usage and a human approved. After a suggestion of yours is rejected, run `npx archik evolution reflect` — repeated rejections become proposals the user can review.
|
|
@@ -49,6 +50,7 @@ These are the verbs you reach for during the loop. Default to `npx archik` (no g
|
|
|
49
50
|
| Validate a file | `npx archik validate <path>` |
|
|
50
51
|
| Spot over-complex files / hubs | `npx archik complexity [--fail-on-warn]` |
|
|
51
52
|
| Find folder loops / oversized files | `npx archik smells [dir] [--json] [--fail-on-warn]` |
|
|
53
|
+
| Accept today's smells as known debt | `npx archik smells --update-baseline` (commit `.archik/smells-baseline.json`) |
|
|
52
54
|
| Stage a proposed change | `npx archik suggest set --note '…' - <<'YAML' … YAML` |
|
|
53
55
|
| Show / accept / reject pending | `npx archik suggest show \| accept \| reject` |
|
|
54
56
|
| Render an SVG | `npx archik render --out diagram.svg` |
|
|
@@ -79,9 +81,9 @@ Every structural change runs the loop. Don't skip phases; don't silently retry o
|
|
|
79
81
|
└─────┬──────┘ exists.
|
|
80
82
|
│
|
|
81
83
|
┌─────▼──────┐ Frame intent in one line + 1–3 sharp clarifying Qs.
|
|
82
|
-
│ DESIGN │ Stage sidecar (`suggest set`) with
|
|
83
|
-
│ │
|
|
84
|
-
└─────┬──────┘
|
|
84
|
+
│ DESIGN │ Stage sidecar (`suggest set`) with its decision
|
|
85
|
+
│ │ record: context, decision, alternatives,
|
|
86
|
+
└─────┬──────┘ consequences. ◄── reject + reason ──┐
|
|
85
87
|
│ │
|
|
86
88
|
┌─────▼──────┐ Canvas diff: accept | reject (why?) | revise. │
|
|
87
89
|
│ DECIDE │ ───────────────────────────────────────────────────►┤
|
|
@@ -100,10 +102,10 @@ Every structural change runs the loop. Don't skip phases; don't silently retry o
|
|
|
100
102
|
|
|
101
103
|
| Phase | Driver | Tool you reach for |
|
|
102
104
|
| -------- | ------------- | --------------------------------------------------- |
|
|
103
|
-
| Discover | Claude | `npx archik q ...` + `npx archik affected` + `npx archik smells` + `ls` |
|
|
104
|
-
| Design | Claude → User | sidecar via `suggest set
|
|
105
|
-
| Decide | User | `/archik:accept` or `/archik:reject` (HITL gate)
|
|
106
|
-
| Build | Claude → User | numbered plan (HITL approval), then small commits
|
|
105
|
+
| Discover | Claude | `npx archik q ...` + `npx archik affected` + `npx archik smells` + `ls` + past records in `.archik/decisions/` |
|
|
106
|
+
| Design | Claude → User | sidecar via `suggest set`, with its decision record |
|
|
107
|
+
| Decide | User | `/archik:accept` or `/archik:reject` (HITL gate) — one-way doors alone, two-way doors together with the plan |
|
|
108
|
+
| Build | Claude → User | numbered plan (own HITL approval for one-way doors), then small commits |
|
|
107
109
|
| Verify | Claude | `npx archik validate` + tests + `drift` + `smells` + SVG regen |
|
|
108
110
|
|
|
109
111
|
**Two non-obvious feedback edges:**
|
|
@@ -172,9 +174,37 @@ edges:
|
|
|
172
174
|
from: payments-worker
|
|
173
175
|
to: order-events
|
|
174
176
|
relationship: subscribes
|
|
177
|
+
metadata:
|
|
178
|
+
suggestion:
|
|
179
|
+
decision:
|
|
180
|
+
context: Orders-api charges Stripe inline, so a slow Stripe call blocks checkout and a Stripe outage fails orders.
|
|
181
|
+
decision: Move charging to a payments worker that subscribes to order.placed on the order-events stream.
|
|
182
|
+
alternatives:
|
|
183
|
+
- Keep the inline call with a shorter timeout and retries
|
|
184
|
+
- Call a payments service synchronously over HTTP
|
|
185
|
+
consequences: Checkout no longer waits on Stripe; payment becomes eventually consistent, so the UI must show a "payment pending" state.
|
|
186
|
+
crossCutting:
|
|
187
|
+
security: The worker alone holds the Stripe key (secret store); events carry order ids, not card data.
|
|
188
|
+
observability: Consumer lag and failed-charge count on the payments dashboard, alert on lag over 5 minutes.
|
|
189
|
+
rollback: A flag switches checkout back to the inline call; the stream is additive.
|
|
175
190
|
YAML
|
|
176
191
|
```
|
|
177
192
|
|
|
193
|
+
**The decision record is required** — `suggest set` refuses a draft without it, and accept writes it to `.archik/decisions/`. Write it for the reader who arrives in a year:
|
|
194
|
+
|
|
195
|
+
- **context** — the problem and the forces (load, failure modes, team limits). Facts, not the solution.
|
|
196
|
+
- **decision** — what you chose, in one or two sentences.
|
|
197
|
+
- **alternatives** — real options you weighed and did not choose. At least one. "Do nothing" counts when it was a real option.
|
|
198
|
+
- **consequences** — what gets easier AND what gets harder. A record with only upsides is not finished.
|
|
199
|
+
- **crossCutting** — required when the change adds data, an outside system or public traffic (the CLI tells you). **security**: who can reach it, secrets, data exposure. **observability**: the signal that shows it working or failing. **rollback**: how to undo it safely. Real answers — the build plan must land them.
|
|
200
|
+
- **supersedes** (optional) — record numbers this one replaces, e.g. `["0003"]`. Old records are never edited.
|
|
201
|
+
|
|
202
|
+
**One-way vs two-way doors.** `suggest set` and `suggest show` label each change. A **one-way door** (hard to undo) adds a data store, queue/stream, external system, gateway/auth/cdn, cloud or LLM node, a new edge to an external system or a top-level module, or removes a built node, or moves one to another parent. Hand it off alone and say why it is hard to undo; the build plan gets its own approval after accept. A **two-way door** is everything else — show the build plan in the same hand-off, and one `/archik:accept` approves both. Never skip review of a one-way door to save time.
|
|
203
|
+
|
|
204
|
+
**Model only what you know.** On a new project, model the first milestone in detail and the rest as coarse `proposed` module placeholders; detail each area when its milestone starts.
|
|
205
|
+
|
|
206
|
+
For a mechanical change (flip `proposed → active` after code lands), keep it short: context = what landed, decision = mark it active, alternative = keep it proposed until deploy, consequence = drift now checks it.
|
|
207
|
+
|
|
178
208
|
The CLI parses, schema-validates, checks cross-file references, stamps `metadata.suggestion`, and atomically writes the sidecar. If it exits non-zero, the error includes a hint pointing at the wrong field — fix the heredoc and re-run. **Never edit the sidecar by hand.**
|
|
179
209
|
|
|
180
210
|
```bash
|
|
@@ -190,6 +220,7 @@ npx archik validate .archik/main.archik.yaml # schema + cross-file + constrain
|
|
|
190
220
|
npx archik drift # diagram vs source tree
|
|
191
221
|
npx archik affected --json # what did this change touch? who depends on it?
|
|
192
222
|
npx archik smells # folder loops + oversized files, from the code
|
|
223
|
+
# (with a baseline, only NEW findings count)
|
|
193
224
|
npx archik render --out docs/architecture.svg # if the project commits an SVG
|
|
194
225
|
```
|
|
195
226
|
|
|
@@ -211,6 +242,9 @@ version: "1.0"
|
|
|
211
242
|
name: Payments internals
|
|
212
243
|
nodes: [ ... ]
|
|
213
244
|
edges: [ ... ]
|
|
245
|
+
metadata:
|
|
246
|
+
suggestion:
|
|
247
|
+
decision: { context: ..., decision: ..., alternatives: [...], consequences: ... }
|
|
214
248
|
YAML
|
|
215
249
|
npx archik suggest accept .archik/payments.archik.yaml
|
|
216
250
|
|
|
@@ -225,6 +259,9 @@ nodes:
|
|
|
225
259
|
... (every other node)
|
|
226
260
|
edges:
|
|
227
261
|
... (every edge)
|
|
262
|
+
metadata:
|
|
263
|
+
suggestion:
|
|
264
|
+
decision: { context: ..., decision: ..., alternatives: [...], consequences: ... }
|
|
228
265
|
YAML
|
|
229
266
|
```
|
|
230
267
|
|
|
@@ -430,6 +467,9 @@ npx archik complexity [path] [--json] # advisory report: over-large files, hub
|
|
|
430
467
|
[--max-nodes N] [--max-edges N] [--max-children N]
|
|
431
468
|
[--max-degree N] [--max-depth N] # override the strict defaults
|
|
432
469
|
npx archik smells [dir] [--json] # folder loops + oversized files, read from TS/JS code
|
|
470
|
+
[--fail-on-warn] # exit 1 on findings (only NEW ones if a baseline exists)
|
|
471
|
+
[--update-baseline] # save today's findings to .archik/smells-baseline.json
|
|
472
|
+
[--baseline <file>] # use another baseline file
|
|
433
473
|
[--max-file-lines N] # line limit per file (default 500)
|
|
434
474
|
[--fail-on-warn] # exit 1 if any smell (CI gate)
|
|
435
475
|
npx archik render --out diagram.svg --theme light|dark
|
|
@@ -450,11 +490,16 @@ npx archik otel check --graph <deps.json> [--json]
|
|
|
450
490
|
|
|
451
491
|
npx archik suggest show [--json]
|
|
452
492
|
suggest set <draft|-> # validate + stage a sidecar
|
|
453
|
-
|
|
493
|
+
# (draft needs metadata.suggestion.decision)
|
|
494
|
+
--note '<text>' # set metadata.suggestion.note (record title)
|
|
454
495
|
--main <path> # override main file detection
|
|
455
496
|
--allow-orphan # permit a sidecar with no main on disk
|
|
456
497
|
--json # structured output
|
|
457
|
-
suggest accept | reject
|
|
498
|
+
suggest accept | reject # accept writes .archik/decisions/NNNN-*.md
|
|
499
|
+
|
|
500
|
+
npx archik migrate [--dry-run] # bring this project's archik files up to the
|
|
501
|
+
# installed version; if validate says a key
|
|
502
|
+
# was "removed in archik 0.20", run this
|
|
458
503
|
|
|
459
504
|
npx archik dev | start | stop | status # canvas server lifecycle
|
|
460
505
|
npx archik watch # re-render to SVG on save
|