archik 0.19.4 → 0.20.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.
@@ -11,10 +11,10 @@
11
11
  "source": "github",
12
12
  "repo": "bacharSalleh/archik"
13
13
  },
14
- "description": "Plain-YAML architecture diagrams + Jacobson use cases / actors / sequence diagrams / alphas, all CLI-mediated and validated. The skill enforces CLI-only access; the slash commands wrap the loop.",
14
+ "description": "Plain-YAML architecture diagrams of code structure (nesting, dependency flow, drift, structural smells), all CLI-mediated and validated. The skill enforces CLI-only access; the slash commands wrap the loop.",
15
15
  "homepage": "https://github.com/bacharSalleh/archik#readme",
16
16
  "license": "MIT",
17
- "keywords": ["architecture", "diagram", "yaml", "jacobson", "ecb"]
17
+ "keywords": ["architecture", "diagram", "yaml"]
18
18
  }
19
19
  ]
20
20
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archik",
3
- "description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams + Jacobson use cases / actors / sequence diagrams / alphas, all CLI-mediated and validated.",
3
+ "description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams of code structure (nesting, dependency flow, drift, structural smells), all CLI-mediated and validated.",
4
4
  "author": {
5
5
  "name": "Bashar",
6
6
  "email": "welcomebachar@gmail.com"
@@ -12,10 +12,6 @@
12
12
  "architecture",
13
13
  "diagram",
14
14
  "yaml",
15
- "jacobson",
16
- "use-case",
17
- "ecb",
18
- "essence",
19
15
  "documentation"
20
16
  ]
21
17
  }
package/README.md CHANGED
@@ -27,13 +27,13 @@
27
27
 
28
28
  Your architecture lives in **plain YAML**. You edit it through a **CLI**, a **validator** rejects drift before it merges, and a **live canvas** renders it in the browser. AI agents — Claude Code, or anything that speaks MCP — read the same YAML as the map of your system, so they reason about structure instead of guessing from filenames.
29
29
 
30
- One chain runs from a stakeholder request to a passing test, and every link is checked mechanically:
30
+ archik focuses on code **structure**: which parts exist, how they nest, which way dependencies flow, and whether the code still agrees:
31
31
 
32
32
  ```
33
- Actor → Use case → Slice → Tests → Sequence diagram → Nodes → Source
33
+ Nodes → Nesting (parentId, sub-files) → Edges → Source code
34
34
  ```
35
35
 
36
- Nothing in that chain can quietly fall out of sync with the code.
36
+ Every link is checked against the code, so the map can't quietly fall out of sync.
37
37
 
38
38
  ## Install
39
39
 
@@ -70,8 +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:usecase <name>` | A use case with flows, slices, and test paths |
74
- | `/archik:trace` | The coverage matrix — "are we done?" |
73
+ | `/archik:evolve [area]` | A proposed cleaner refactor, backed by drift and smells |
75
74
 
76
75
  Already have docker-compose or Mermaid? Bootstrap from it instead of a blank canvas:
77
76
 
@@ -110,12 +109,9 @@ There are no coordinates — layout is computed by [ELK](https://eclipse.dev/elk
110
109
  | Layer | File | Captures |
111
110
  | --- | --- | --- |
112
111
  | Structure | `.archik/main.archik.yaml` | Services, databases, queues, agents, LLMs, edges |
113
- | Actors | `*.archik.actors.yaml` | Who initiates use cases |
114
- | Requirements | `.archik/usecases/*.archik.uc.yaml` | Flows and slices that name **test paths** |
115
- | Behaviour | `*.archik.seq.yaml` | UML-subset sequence diagrams |
116
- | Progress | `*.archik.alphas.yaml` | Essence/SEMAT alphas, machine-verified |
112
+ | Sub-architecture | `.archik/*.archik.yaml` | A node's internals, linked via `archikFile` |
117
113
 
118
- Full schema: `npx archik schema` (also `schema seq | uc | actors`).
114
+ Full schema: `npx archik schema`.
119
115
 
120
116
  ## Keeping the model honest
121
117
 
@@ -123,14 +119,14 @@ A set of commands prove the diagram still matches reality, at every altitude:
123
119
 
124
120
  ```bash
125
121
  npx archik validate # schema + cross-file integrity + governance constraints
126
- npx archik drift # nodes/tests vs the source tree
122
+ npx archik drift # nodes vs the source tree
127
123
  npx archik drift --edges # edges vs the TS/JS import graph (shadow + phantom edges)
128
- npx archik affected --since main --run # changed files → nodes → slices → run their tests
129
- npx archik trace --fail-on partial # coverage matrix; gate CI on incomplete traceability
124
+ npx archik smells # folder import loops + oversized files, read from the code
125
+ npx archik affected --since main # changed files → nodes → dependents
130
126
  npx archik otel check --graph deps.json # edges vs a production service-dependency graph
131
127
  ```
132
128
 
133
- `validate` proves the model is internally consistent, `drift` that it matches the code, and `otel check` that it matches production traffic. Gate every commit locally:
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:
134
130
 
135
131
  ```bash
136
132
  npx archik hooks install # pre-commit: archik validate
@@ -142,7 +138,7 @@ Large models stay readable: `archik complexity` flags over-large files, hub node
142
138
 
143
139
  **Claude Code.** `archik init` installs a skill that enforces one rule — *Claude talks to archik only through the CLI*, never by editing YAML directly. Reads go through `archik q`, writes through `archik suggest set`, and you approve every structural change on the canvas.
144
140
 
145
- **Everything else (MCP).** `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — tools for schema, queries, trace, validate, drift, and the suggestion lifecycle, plus resources (`archik://schema`, `archik://stats`, `archik://trace`) and prompts that encode the same loop:
141
+ **Everything else (MCP).** `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — tools for schema, queries, validate, drift, smells, and the suggestion lifecycle, plus resources (`archik://schema`, `archik://stats`, `archik://smells`) and prompts that encode the same loop:
146
142
 
147
143
  ```jsonc
148
144
  // .cursor/mcp.json, claude_desktop_config.json, etc.
@@ -176,7 +172,7 @@ Intentional exceptions are grandfathered by id in an `except` list — visible i
176
172
 
177
173
  ## CI
178
174
 
179
- Run the commands directly, or use the GitHub Action, which validates, checks drift and traceability, and posts a sticky PR comment with the architecture diff against the base branch:
175
+ Run the commands directly, or use the GitHub Action, which validates, checks drift, reports smells, and posts a sticky PR comment with the architecture diff against the base branch:
180
176
 
181
177
  ```yaml
182
178
  # .github/workflows/archik.yml
@@ -192,10 +188,10 @@ jobs:
192
188
  - uses: actions/checkout@v4
193
189
  - uses: bacharSalleh/archik@main
194
190
  with:
195
- trace-fail-on: partial # optional gate; omit for report-only
191
+ smells-fail: true # optional gate; omit for report-only
196
192
  ```
197
193
 
198
- Inputs: `path`, `working-directory`, `validate`, `drift`, `trace-fail-on`, `compare-ref`, `comment`, `github-token`, `version`.
194
+ Inputs: `path`, `working-directory`, `validate`, `drift`, `smells-fail`, `compare-ref`, `comment`, `github-token`, `version`.
199
195
 
200
196
  ## Self-evolution
201
197
 
@@ -211,16 +207,15 @@ Every command supports `--help`; agent-facing commands support `--json`.
211
207
  | `archik dev` / `start` / `stop` / `status` | Live canvas lifecycle (foreground / detached) |
212
208
  | `archik validate [path]` | Schema + cross-file + constraints (exit 1 on error) |
213
209
  | `archik complexity [path]` | Flag over-large files, hub nodes, deep nesting (`--fail-on-warn` to gate) |
214
- | `archik render --out <svg>` | Headless SVG render (`--seq <path>`, `--focus <id>`, `--hide-structural`) |
210
+ | `archik smells [dir]` | Folder import loops + oversized source files, from the code (`--max-file-lines`, `--fail-on-warn`) |
211
+ | `archik render --out <svg>` | Headless SVG render (`--focus <id>`, `--hide-structural`) |
215
212
  | `archik watch` | Re-render SVG on every change |
216
- | `archik q <sub>` | Query: `describe` `deps` `dependents` `neighbors` `impact` `list` `edges` `stats` `usecases` `describe-usecase` `actors` `sequences` |
213
+ | `archik q <sub>` | Query: `describe` `deps` `dependents` `neighbors` `impact` `list` `edges` `stats` |
217
214
  | `archik diff <a> [b]` | Diff two files **or git refs**; one arg = that ref vs working tree |
218
- | `archik affected` | Changed files → nodes, slices, tests (`--since <ref>`, `--files`, `--run`) |
219
- | `archik trace` | Coverage matrix (`--fail-on partial\|none` for CI) |
220
- | `archik drift` | sourcePath / test-path gaps (`--edges` verifies edges vs the import graph) |
215
+ | `archik affected` | Changed files → nodes, dependents, model files, unmapped (`--since <ref>`, `--files`) |
216
+ | `archik drift` | sourcePath gaps (`--edges` verifies edges vs the import graph) |
221
217
  | `archik otel check --graph <f>` | Verify edges against a production service-dependency graph |
222
218
  | `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` |
223
- | `archik alpha <sub>` | Essence alphas: `show`, `promote`, `demote` |
224
219
  | `archik evolution <sub>` | Self-evolution loop: `enable` `reflect` `proposals` `approve` `reject` `report` |
225
220
  | `archik patterns <sub>` | Pattern library: `list` `show <id>` `apply <id>` |
226
221
  | `archik import compose\|mermaid [file]` | Bootstrap from docker-compose or a Mermaid flowchart |
@@ -228,23 +223,23 @@ Every command supports `--help`; agent-facing commands support `--json`.
228
223
  | `archik hooks install` | Pre-commit hook running `archik validate` (`--with-drift` optional) |
229
224
  | `archik owners sync\|check` | Keep CODEOWNERS in step with node owners |
230
225
  | `archik mcp` | MCP server over stdio for non-Claude-Code agents |
231
- | `archik schema [seq\|uc\|actors]` | Print the document schemas |
226
+ | `archik schema` | Print the document schema |
232
227
  | `archik upgrade` | Upgrade + refresh installed skill/commands |
233
228
 
234
229
  Default file resolution: `.archik/main.archik.yaml`, falling back to the legacy `architecture.archik.yaml` (both present is an error).
235
230
 
236
231
  ## When to use it
237
232
 
238
- Reach for archik when a project has more than a handful of components, ships with an AI agent you want reasoning about structure, needs "are we done?" to be mechanically answerable, or wants CI to fail on architectural drift. Skip it for one-file scripts, slide-deck diagrams (use Mermaid), or projects with no build or CI.
233
+ Reach for archik when a project has more than a handful of components, ships with an AI agent you want reasoning about structure, wants folder loops caught with real import evidence, or wants CI to fail on architectural drift. Skip it for one-file scripts, slide-deck diagrams (use Mermaid), or projects with no build or CI.
239
234
 
240
235
  | | archik | Mermaid / PlantUML | Structurizr |
241
236
  | --- | --- | --- | --- |
242
237
  | Source format | Plain YAML | Custom DSL | Structurizr DSL |
243
238
  | AI-editor integration | **Skill + MCP** | None | None |
244
- | Use cases / test traceability | **Mechanical** | No | No |
239
+ | Structural smells from code | **Yes** | No | No |
245
240
  | Drift detection | **Yes** | No | No |
246
241
  | Governance constraints | **Yes** | No | No |
247
- | Validator | **Schema + cross-file + ECB** | Syntax only | Syntax only |
242
+ | Validator | **Schema + cross-file + constraints** | Syntax only | Syntax only |
248
243
 
249
244
  ## Contributing
250
245
 
@@ -29,31 +29,9 @@ done at step 1 — the diagram changed; the code probably hasn't.
29
29
  non-code-bearing kind, description-only edit, pure metadata),
30
30
  skip steps 3–6 and jump straight to step 7.
31
31
 
32
- 3. **BUILD — behavioral model first, then plan (HITL).**
32
+ 3. **BUILD — plan (HITL).**
33
33
 
34
- **Before writing the plan**, check whether any new or modified
35
- slice has behavior that warrants a seq diagram. A slice needs
36
- one when it involves branching, async fan-out, cross-context
37
- interaction, or three or more nodes in a single user-visible
38
- action. Run:
39
- ```
40
- npx archik q usecases
41
- ```
42
- For each active slice without a `realization.seqFile` that meets
43
- the above criteria:
44
- - Author the `.archik.seq.yaml` now (direct-write), including a
45
- `realizes: { useCase, slice }` block.
46
- - Run `npx archik validate` — catches ECB violations, broken
47
- `nodeId` refs, and duplicate step ids.
48
- - Show the seq YAML inline and wait for confirmation before
49
- writing the plan.
50
-
51
- A slice without a seq diagram has no traceable spec — the build
52
- plan for it is guesswork. Author the seq first; trace it in the
53
- plan. If the slice is genuinely simple (single node, no
54
- branching), skip the seq and note why.
55
-
56
- **Then** translate the diagram delta into a numbered file-level
34
+ Translate the diagram delta into a numbered file-level
57
35
  plan and present it for approval **before** touching code:
58
36
  - Each new code-bearing node (`service`, `function`, `worker`,
59
37
  `module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
@@ -62,13 +40,6 @@ done at step 1 — the diagram changed; the code probably hasn't.
62
40
  - Each new edge that requires code → the corresponding code
63
41
  change (a new `http_call` needs a client; `subscribes` needs a
64
42
  consumer handler; `writes` needs a repository method; etc).
65
- - Each seq diagram that realizes a slice → trace it: every
66
- message in the seq must map to a concrete function call in this
67
- plan. This is the traceability requirement — the seq is the
68
- spec, the plan is the contract, the code is the proof.
69
- - Each slice's `tests` paths → include scaffolding those test
70
- files in the plan; they must exist on disk before the slice
71
- can be marked active.
72
43
  - Any node still `status: proposed` → flag it; code must land
73
44
  before flipping to `active`.
74
45
  - Default to **tests-first** when behaviour is clearly bounded.
@@ -106,15 +77,13 @@ done at step 1 — the diagram changed; the code probably hasn't.
106
77
  ```
107
78
  npx archik drift
108
79
  ```
109
- Catches both missing `sourcePath` directories and missing slice
110
- test files on disk.
111
- If the project has use cases, run the coverage matrix:
80
+ Catches missing `sourcePath` directories on disk.
112
81
  ```
113
- npx archik trace
82
+ npx archik smells
114
83
  ```
115
- No active slice should be untraced at ship time. Partial is a
116
- warning; untraced is a gap — add the missing test path or
117
- realization seq before declaring the milestone done.
84
+ Catches folder loops and oversized files, with the real imports
85
+ as evidence. A new loop is a gap — cut the cheapest import (or
86
+ queue a `/archik:suggest`) before declaring the milestone done.
118
87
  `superpowers:verification-before-completion` when available.
119
88
  If `docs/architecture.svg` is committed, regenerate it:
120
89
  ```
@@ -128,12 +97,3 @@ done at step 1 — the diagram changed; the code probably hasn't.
128
97
  - *"Want me to schedule a drift check in two weeks?"*
129
98
  - *"This left `payments-worker` as `status: proposed` — flip it
130
99
  to `active` once deployed."*
131
- - If this milestone completed a significant chunk of work, check
132
- whether any alpha state can be promoted:
133
- ```
134
- npx archik alpha show
135
- ```
136
- If a state is verified and the next rung's criteria are met,
137
- offer to promote: *"Requirements is at `acceptable` and all
138
- active slices now have tests — want me to promote it to
139
- `addressed`?"*
@@ -38,8 +38,8 @@ brief and start the DESIGN loop.
38
38
 
39
39
  1. Confirm with the user once before writing anything:
40
40
  > "I see this is a fresh project. I'll scaffold archik, then ask
41
- > for a one-paragraph brief so I can model the actors and your
42
- > first use case. Sound right?"
41
+ > for a one-paragraph brief so I can model the first piece you
42
+ > should ship. Sound right?"
43
43
  2. On confirmation, run:
44
44
  ```sh
45
45
  npx archik@latest init
@@ -48,9 +48,8 @@ brief and start the DESIGN loop.
48
48
  and skip step 4. Otherwise:
49
49
  4. **Ask for the brief**, in this exact shape (so the user knows
50
50
  what fields you actually need). The closing line is the load-
51
- bearing one — it commits the conversation to actors-first +
52
- pick-exactly-one + ship-it-with-tests, which is the framing
53
- that makes the rest of the loop work:
51
+ bearing one — it commits the conversation to pick-exactly-one,
52
+ which is the framing that makes the rest of the loop work:
54
53
  > "Send me a project brief in this shape (skip any line that
55
54
  > doesn't apply):
56
55
  >
@@ -60,18 +59,15 @@ brief and start the DESIGN loop.
60
59
  > **Constraints:** budget, deadline, team size, hard-no's.
61
60
  > **Out of scope:** things you explicitly DON'T want.
62
61
  >
63
- > **Then end with:** *'Start by modelling the actors and the
64
- > first use case I should ship.'* — that single line is what
65
- > forces priorities into the open before any code lands. The
66
- > use case names its test paths from message one; slices start
67
- > `status: proposed` (because the tests don't exist on disk
68
- > yet) and flip to `status: active` automatically when the
69
- > tests land in BUILD. The commitment lives in the YAML, not
70
- > in the chat log."
62
+ > **Then end with:** *'Start by modelling the smallest structure
63
+ > for the first thing I should ship.'* — that single line is what
64
+ > forces priorities into the open before any code lands. New
65
+ > nodes start `status: proposed` (the code doesn't exist on disk
66
+ > yet) and flip to `status: active` when the code lands in BUILD.
67
+ > The commitment lives in the YAML, not in the chat log."
71
68
  5. When the brief lands, run the standard DESIGN loop:
72
- `/archik:actor` (if needed) → `/archik:usecase` → `/archik:suggest`
73
- (structural sidecar) → behavioural seq files. Stop at each
74
- inline-review gate; don't barrel through.
69
+ `/archik:suggest` (structural sidecar) → `/archik:accept` →
70
+ BUILD. Stop at each inline-review gate; don't barrel through.
75
71
 
76
72
  ### B. No `.archik/` yet, but source code exists (existing project)
77
73
 
@@ -94,8 +90,8 @@ diagram, then iterate from honest ground truth.
94
90
  `.claude/commands/archik/spawn.md` for the steps. Don't
95
91
  duplicate them here.
96
92
  4. After the user accepts the spawn sidecar, suggest the natural
97
- follow-up: "Want to author the first use case for what you're
98
- actively working on right now? `/archik:usecase <name>`."
93
+ follow-up: "Want to check the code for structural smells?
94
+ `npx archik smells` finds folder loops and oversized files."
99
95
 
100
96
  ### C. `.archik/` exists but the diagram is empty or near-empty
101
97
 
@@ -113,19 +109,20 @@ Skip the `init` step in both — the file already exists.
113
109
  The project is already running the loop. Don't re-bootstrap. Surface
114
110
  the current state and let the user pick the next move:
115
111
 
116
- 1. Run two queries to ground the user in where they are:
112
+ 1. Run three checks to ground the user in where they are:
117
113
  ```sh
118
114
  npx archik q stats
119
- npx archik trace
115
+ npx archik drift
116
+ npx archik smells
120
117
  ```
121
- 2. Translate the trace totals into one sentence: "X full slices,
122
- Y partial, Z untraced." Name the worst-case slice if any.
118
+ 2. Sum it up in one sentence: "X nodes, Y drift findings, Z
119
+ smells." Name the worst finding if any.
123
120
  3. Suggest the next action based on state:
124
- - **All traced** → "Ready to ship. Want to add a feature?
125
- `/archik:suggest <feature>`. Or start a new use case?
126
- `/archik:usecase <name>`."
127
- - **Partial / untraced** → "The biggest gap is `<slice-id>`
128
- — it's missing `<thing>`. Want me to fix it?"
121
+ - **Clean** → "Ready to ship. Want to add a feature?
122
+ `/archik:suggest <feature>`."
123
+ - **Drift or smells** → "The biggest gap is `<finding>` — the
124
+ evidence is `<file imports "specifier">` (or the drift line).
125
+ Want me to fix it?"
129
126
 
130
127
  ## Notes
131
128
 
@@ -137,7 +134,7 @@ the current state and let the user pick the next move:
137
134
  - Don't skip `init` if it's needed. The slash commands rely on
138
135
  `npx archik` being callable from the project root, and `init`
139
136
  also makes sure the skill + slash commands are installed.
140
- - **Do not** start writing actors / use cases / sidecars before
137
+ - **Do not** start writing sidecars or code before
141
138
  the user replies to your "sound right?" check. Bootstrap is the
142
139
  one place where confirming-before-acting is more important than
143
140
  speed — the user is still calibrating what archik will do.
@@ -45,26 +45,15 @@ any file under `.archik/`.
45
45
  — there's nothing meaningful to evolve. Suggest `/archik:spawn`
46
46
  first.
47
47
 
48
- Also check the Jacobson-chain artifacts so you can surface
49
- ECB and coverage smells alongside structural ones:
48
+ Also read the code-level smells, so your proposal rests on real
49
+ imports and not only on the diagram:
50
50
  ```
51
- npx archik q actors
52
- npx archik q usecases
53
- npx archik trace --json
51
+ npx archik smells --json
54
52
  ```
55
- (These are non-fatal if no UC/actor files exist — note that
56
- and skip the UC smells below; focus on structural smells only.)
57
-
58
- **Identify nodes at risk of seq breakage.** As you read the
59
- node list, mentally note which nodes you're likely to remove,
60
- split, or merge. For each such node, run:
61
- ```
62
- npx archik q sequences --node <id>
63
- ```
64
- This returns the seq files whose participants reference that
65
- node ID. Collect these — you'll need the list in step 6 to
66
- warn the user. If the list is empty for all affected nodes,
67
- no seq diagrams are at risk.
53
+ It reports folder loops (sibling folders that import each other,
54
+ with each `file imports "specifier"` as evidence and the cheapest
55
+ import to cut) and oversized files. It needs no model, so it
56
+ works even when the diagram is thin.
68
57
 
69
58
  3. **Identify smells and missing structure.** Don't propose change
70
59
  for change's sake — every modification should fix one of:
@@ -85,30 +74,12 @@ any file under `.archik/`.
85
74
  introduce a `port` (the abstract contract) and an `adapter`
86
75
  (the concrete impl), with `implements` between them.
87
76
  - **Cyclic dependencies** between modules — should be inverted
88
- (events) or broken (extract shared kernel).
77
+ (events) or broken (extract shared kernel). Use the folder loops
78
+ from `archik smells` as evidence: quote the imports, and start
79
+ with the "cheapest to cut" edge.
89
80
  - **Anaemic queues.** Two services connected by `http_call`
90
81
  for what's clearly an async fire-and-forget → introduce a
91
82
  `queue` or `topic` and rewire to `publishes` / `subscribes`.
92
- - **Missing ECB stereotypes.** Only applies when actor/UC files
93
- exist (`npx archik q usecases` returns results). Nodes that
94
- appear in active UC slices (visible in `archik trace` output),
95
- or that have user-facing relationships (`http_call` from a
96
- gateway, `writes`/`reads` to a domain DB) but no `stereotype`
97
- field → classify each as `boundary`, `control`, or `entity`.
98
- This is a prerequisite for ECB validation on seq diagrams.
99
- Evolve may **add** a stereotype to nodes spawn left blank, but
100
- only when this smell is triggered. Never invent stereotypes on
101
- a pure structural diagram with no UC files.
102
- - **UC coverage gaps.** Only applies when UC files exist and
103
- `archik trace --json` returns rows. Active slices that are
104
- `partial` (tests exist but no seq realization) usually signal
105
- a missing seq diagram or a missing port/adapter in the
106
- structural model. Active slices that are `none` (no tests, no
107
- realization) signal untested behaviour — propose a test
108
- scaffold or a seq diagram, and flag any architectural gap that
109
- makes the slice hard to realize (e.g. missing adapter for an
110
- external call). If trace output is empty or all slices are
111
- `full`, skip this smell.
112
83
 
113
84
  Aim for 3–8 changes — enough to be meaningful, few enough that
114
85
  the user can reason about each. If you'd need more, propose
@@ -144,7 +115,7 @@ any file under `.archik/`.
144
115
  ids, never rename. Renames break diff and require the user to
145
116
  manually re-link references in code.
146
117
  - Don't drop `description`, `responsibilities`, `notes`,
147
- `sourcePath`, or `stereotype` fields the user authored. Carry
118
+ `owner`, or `sourcePath` fields the user authored. Carry
148
119
  them over verbatim.
149
120
  - Every new code-bearing node (`service`, `function`, `worker`,
150
121
  `module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
@@ -160,9 +131,6 @@ any file under `.archik/`.
160
131
  until the code lands.
161
132
  - Every node MUST have a non-empty `description` explaining
162
133
  what it does. Don't introduce a node without one.
163
- - When adding a `stereotype` to address the ECB smell, use only
164
- `boundary`, `control`, or `entity`. Don't add `stereotype` to
165
- purely infra nodes (`database`, `queue`, `external`, `cloud`).
166
134
  - Every change should be motivated by step 3, not by aesthetics.
167
135
 
168
136
  If `suggest set` reports validation errors, re-run with the
@@ -176,13 +144,7 @@ any file under `.archik/`.
176
144
  grouped by motivation (e.g. *"1. Extract a `payments`
177
145
  bounded context from `orders`. Why: payment logic was leaking
178
146
  into order placement…"*). Keep each item to 2–3 sentences.
179
- c. **Seq diagram impact warning** — if any seq file discovered
180
- in step 2 references a node that this proposal removes or
181
- renames, list them explicitly:
182
- *"⚠️ These seq diagrams reference nodes this refactor
183
- changes — they will need updating after accept: `<list>`."*
184
- If no seq files are affected, skip this bullet.
185
- d. An explicit invitation: *"Tell me what you'd like to keep,
147
+ c. An explicit invitation: *"Tell me what you'd like to keep,
186
148
  drop, or rework before you accept. I can re-stage with
187
149
  changes — `/archik:accept` is whenever you're ready."*
188
150
 
@@ -1,84 +1,60 @@
1
1
  ---
2
- description: Finish a migration — back-fill the artifacts the migrator flagged
2
+ description: Finish a migration — check the result and fix what the migrator flagged
3
3
  ---
4
4
 
5
- # /archik:migrate — back-fill what the deterministic migration couldn't
5
+ # /archik:migrate — check what the deterministic migration did
6
6
 
7
7
  `archik upgrade --migrate` already ran the **deterministic** migration:
8
- it archived the old project, moved files into the current layout,
9
- validated, and advanced `.archik/.version`. It then flagged the parts
10
- that need **judgment** — usually: *the project has an architecture but no
11
- use cases / sequence diagrams.* Your job is to back-fill those, grounded
12
- in **both** the current model and the **archived original**.
8
+ it archived the old project, ran each pending step, validated, and
9
+ advanced `.archik/.version`. The current steps are:
13
10
 
14
- The deterministic steps are done. Do NOT redo them. You author the
15
- missing artifacts; `archik validate` is your gate.
11
+ - **#1** — move a legacy root `architecture.archik.yaml` into
12
+ `.archik/main.archik.yaml`.
13
+ - **#3** — strip retired node fields (`stereotype`, `seqFiles`) from the
14
+ model files.
16
15
 
17
- ## CLI-only for architecture; direct-write for the Jacobson files
16
+ (#2, the old use-case back-fill, is retired and never runs.)
18
17
 
19
- Interact with the architecture diagram only through `npx archik`. Actors,
20
- use cases, and sequence diagrams are **direct-write** files (no sidecar) —
21
- author them with `Write`, then `npx archik validate`. Never edit
22
- `.archik/main.archik.yaml` by hand. **Never delete `.archik.archive/`** —
23
- it is the developer's only copy of the pre-migration project.
18
+ The deterministic steps are done. Do NOT redo them. Your job is to check
19
+ the result against the **archived original** and fix anything the
20
+ migrator printed as needing judgment. `archik validate` is your gate.
21
+
22
+ ## CLI-only for architecture
23
+
24
+ Interact with the architecture diagram only through `npx archik`. Never
25
+ edit `.archik/main.archik.yaml` by hand — changes go through
26
+ `suggest set` → `accept`. **Never delete `.archik.archive/`** — it is the
27
+ developer's only copy of the pre-migration project.
24
28
 
25
29
  ## Steps
26
30
 
27
- 1. **See exactly what's missing.** The migrator's `needsJudgment` hint is
28
- printed once and not re-derivable, so check the project directly:
29
- ```bash
30
- npx archik q usecases # empty → use cases need back-filling
31
- npx archik q actors # empty → actors needed first (use cases reference them)
32
- npx archik q sequences # which flows already have a seq diagram
33
- ```
31
+ 1. **Read the migrator's output.** Any `ⓘ` line it printed is a task for
32
+ you. If it printed none, the steps below are a quick check only.
34
33
 
35
- 2. **Read the archived original — this is the migration's whole point.**
36
- Find the newest archive and read the old project's intent (descriptions,
37
- any notes, the old structure) so the back-fill reflects what the
38
- developer actually built, not a generic guess:
34
+ 2. **Find the archived original.**
39
35
  ```bash
40
36
  ls -t .archik.archive/ # newest timestamp dir is the pre-migration copy
41
37
  ```
42
38
  Read the files under that dir with the `Read` tool (the archive is a
43
39
  plain backup, not a live archik doc — reading it directly is correct).
40
+ Note any old use case, sequence, or stereotype files there: their
41
+ content is no longer modelled. Do not recreate them.
44
42
 
45
- 3. **Ground the use cases in the current model.** Combine the archive's
46
- intent with the live structure:
47
- ```bash
48
- npx archik q stats
49
- npx archik q list
50
- npx archik q edges
51
- ```
52
-
53
- 4. **Author actors first** (if `q actors` was empty). Use cases reference
54
- actors by id, and validate rejects a use case whose `primaryActor`
55
- isn't in the actor index. Direct-write `.archik/actors.archik.actors.yaml`
56
- (schema: `npx archik schema actors`), then `npx archik validate`.
57
-
58
- 5. **Author one use case per real flow.** Direct-write
59
- `.archik/usecases/<id>.archik.uc.yaml` (schema: `npx archik schema uc`).
60
- Mark each slice `status: proposed` and give it `tests:` paths only if
61
- those files exist on disk — otherwise omit `tests` (active slices
62
- require on-disk tests). Validate after each:
63
- `npx archik validate .archik/main.archik.yaml`.
64
-
65
- 6. **Author a sequence diagram per primary slice.** Direct-write
66
- `.archik/<usecase>.<slice>.archik.seq.yaml` (schema: `npx archik schema seq`).
67
- Every participant `nodeId` must be a real node; add a `realizes` block
68
- AND point the slice's `realization.seqFile` back at the file
69
- (bidirectional). Add the seq to each participating node's `seqFiles`
70
- via the normal `suggest set` → `accept` workflow.
71
-
72
- 7. **Verify and report.** Then propose the natural next step (write the
73
- tests the slices name, flip them to `active`), don't end on "done":
43
+ 3. **Check the live model.**
74
44
  ```bash
75
45
  npx archik validate .archik/main.archik.yaml
76
- npx archik trace
46
+ npx archik q stats
77
47
  npx archik drift
48
+ npx archik smells
78
49
  ```
79
50
 
51
+ 4. **Fix gaps through the normal workflow.** If drift or the archive
52
+ shows structure the model misses (a node, an edge, a `parentId`
53
+ container), stage it with `/archik:suggest`. Don't bulk-restructure.
54
+
80
55
  ## Done when
81
56
 
82
- `archik validate` is clean and `archik q usecases` lists the back-filled
83
- use cases, each primary slice realising a sequence diagram. The archive
84
- stays untouched as the developer's rollback.
57
+ `archik validate` is clean, every `ⓘ` line from the migrator is
58
+ handled, and you proposed the natural next step (fix drift, cut a folder
59
+ loop that `smells` found). The archive stays untouched as the
60
+ developer's rollback.
@@ -35,8 +35,9 @@ Never `Read`/`Write`/`Edit` files under `.archik/`.
35
35
  No feedback signal = no evolution loop; help them find one first.
36
36
 
37
37
  3. **Ground in the current diagram** (`npx archik q stats`, `q list`).
38
- If the project is empty, model the *base system* first — actors,
39
- then one use case to ship, per the normal archik opening move.
38
+ If the project is empty, model the *base system* first — the
39
+ smallest structure for one thing to ship, per the normal archik
40
+ opening move.
40
41
 
41
42
  4. **Map the idea onto the loop.** For each stage, name the concrete
42
43
  component in THEIR system:
@@ -56,10 +57,9 @@ Never `Read`/`Write`/`Edit` files under `.archik/`.
56
57
  - Tailored: author the full end-state and stage via
57
58
  `npx archik suggest set --note '…' - <<'YAML' … YAML`.
58
59
 
59
- 6. **Wire the requirements.** Author a use case for the loop itself
60
- (`/archik:usecase` conventions): slices like "corrections are
61
- recorded", "insights become proposals", "approved change applies",
62
- each naming test paths.
60
+ 6. **Wire the tests.** Name one test per loop step: "corrections are
61
+ recorded", "insights become proposals", "approved change applies".
62
+ Add them to the build plan after accept.
63
63
 
64
64
  7. **Hand over.** Show the canvas URL, summarize which patterns you
65
65
  used and why, and point at `npx archik evolution enable` if they