archik 0.6.21 → 0.7.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.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Apply the pending archik suggestion sidecar over the main file
3
+ ---
4
+
5
+ # /archik:accept — apply the pending suggestion
6
+
7
+ The user wants to accept the pending architecture suggestion.
8
+
9
+ Run the CLI — do NOT edit any archik file by hand:
10
+
11
+ ```
12
+ npx archik suggest accept
13
+ ```
14
+
15
+ If it exits 0, also run `npx archik validate` to confirm the new main
16
+ file is clean, and tell the user it's applied.
17
+
18
+ If it exits non-zero (no sidecar present, or the sidecar fails to
19
+ parse), surface the error to the user verbatim and stop. Do not
20
+ attempt to fix the sidecar by editing it; ask the user how they
21
+ want to proceed.
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Describe a node in the archik diagram and its incoming/outgoing edges
3
+ argument-hint: <node-id>
4
+ ---
5
+
6
+ # /archik:describe — explain a node from the archik diagram
7
+
8
+ The user wants details about the node with id **$ARGUMENTS**.
9
+
10
+ Use the query CLI — do NOT `cat` or read any archik YAML directly:
11
+
12
+ ```
13
+ npx archik q describe $ARGUMENTS
14
+ ```
15
+
16
+ If you need adjacent context, also run:
17
+
18
+ ```
19
+ npx archik q deps $ARGUMENTS
20
+ npx archik q dependents $ARGUMENTS
21
+ ```
22
+
23
+ Summarize what came back in plain prose: the node's kind and stack,
24
+ what it depends on, what depends on it, and any responsibilities or
25
+ notes. Don't dump the raw CLI output unless the user asks for it.
26
+
27
+ If the CLI exits 1 (unknown id), tell the user and offer to run
28
+ `npx archik q list` to find the right id.
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Start the archik live canvas in the browser (detached)
3
+ ---
4
+
5
+ # /archik:dev — open the archik canvas
6
+
7
+ The user wants the live archik canvas running so they can see the
8
+ diagram and review suggestions visually.
9
+
10
+ Run the CLI — do NOT spawn dev servers any other way:
11
+
12
+ ```
13
+ npx archik status
14
+ ```
15
+
16
+ If nothing is running for this project, start it detached:
17
+
18
+ ```
19
+ npx archik start
20
+ ```
21
+
22
+ Surface the URL it prints (or the existing URL from `status`) so the
23
+ user can click straight to it. Do not try to open the browser
24
+ yourself.
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Discard the pending archik suggestion sidecar
3
+ ---
4
+
5
+ # /archik:reject — discard the pending suggestion
6
+
7
+ The user wants to throw away the pending architecture suggestion.
8
+
9
+ Run the CLI — do NOT delete files manually:
10
+
11
+ ```
12
+ npx archik suggest reject
13
+ ```
14
+
15
+ Surface the result to the user. If there was no pending sidecar, the
16
+ command will say so — pass that through unchanged.
@@ -0,0 +1,73 @@
1
+ ---
2
+ description: Propose architecture changes to the archik diagram from a feature description
3
+ argument-hint: <feature description>
4
+ ---
5
+
6
+ # /archik:suggest — propose architecture changes
7
+
8
+ The user wants you to capture the structural impact of a feature in
9
+ the archik diagram. The user-facing description is:
10
+
11
+ **$ARGUMENTS**
12
+
13
+ This slash command IS the user's confirmation that they want a
14
+ sidecar suggestion. Skip the "want me to update the YAML?" question
15
+ and produce one now.
16
+
17
+ ## CLI-only — do not touch archik files directly
18
+
19
+ You MUST interact with archik exclusively through the `npx archik`
20
+ CLI. Do NOT use Read, Write, or Edit on any file under `.archik/`,
21
+ on `architecture.archik.yaml`, or on any sidecar. The CLI is the
22
+ sanctioned interface; everything else is a manual edit and breaks
23
+ the contract with the user.
24
+
25
+ ## Steps
26
+
27
+ 1. **Make sure the canvas is running** so the user can review:
28
+ ```
29
+ npx archik status
30
+ ```
31
+ If nothing is running for this project, start it detached:
32
+ ```
33
+ npx archik start
34
+ ```
35
+ Note the URL it prints — you'll surface it at the end.
36
+
37
+ 2. **Ground yourself in the current diagram** using the query CLI
38
+ (do not `cat` the YAML):
39
+ ```
40
+ npx archik q stats
41
+ npx archik q list
42
+ ```
43
+ If `$ARGUMENTS` mentions a specific node by name, also run
44
+ `npx archik q describe <id>` for it.
45
+
46
+ 3. **Author the draft** in a workspace temp file (NOT under
47
+ `.archik/`). Use the path `/tmp/archik-draft-<short-id>.yaml`.
48
+ The draft is the *full proposed end-state* of the document — every
49
+ node and edge, not just the delta. Follow the schema, kinds, and
50
+ relationships documented in the archik skill.
51
+
52
+ 4. **Stage the draft as the sidecar via the CLI**:
53
+ ```
54
+ npx archik suggest set /tmp/archik-draft-<id>.yaml --note "$ARGUMENTS"
55
+ ```
56
+ This validates the schema, checks cross-file references, stamps
57
+ `metadata.suggestion`, and atomically renames it into place. If
58
+ the command exits non-zero, fix the reported errors in the temp
59
+ file and re-run — never edit the sidecar directly.
60
+
61
+ 5. **Tell the user how to review**. Surface the canvas URL from
62
+ step 1 plus the terminal options:
63
+ - "📝 Suggestion ready — open the canvas at <URL> and use the
64
+ **Review** banner to see added/removed/changed nodes."
65
+ - "Or from the terminal: `npx archik suggest show` /
66
+ `npx archik suggest accept` / `npx archik suggest reject`."
67
+
68
+ ## Notes
69
+
70
+ - If a sidecar already exists, `suggest set` overwrites it. Mention
71
+ to the user that you replaced their previous pending suggestion.
72
+ - If `npx archik` is unreachable (offline, sandboxed), STOP and tell
73
+ the user. Do not fall back to writing YAML by hand.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: archik
3
- description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml exists in the project, or the user asks about the system's architecture, services, dependencies, or data flow. The YAML is the shared map of the project between the user and Claude — read it before answering structural questions, and propose updates when work introduces or changes nodes/edges. Also covers the archik CLI for validation and rendering.
3
+ description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml exists in the project, or the user asks about the system's architecture, services, dependencies, or data flow. The YAML is the shared map between the user and Claude. Interact with it ONLY through the `npx archik` CLI — `q` for queries, `suggest set` for proposals, `validate` after every change. Never read, write, or edit archik files manually.
4
4
  ---
5
5
 
6
6
  # Archik — the project's shared map
@@ -20,29 +20,66 @@ The file lives in one of two places, in this order of preference:
20
20
  2. `architecture.archik.yaml` — the legacy root location, still
21
21
  fully supported.
22
22
 
23
- Run `archik validate` (or check both paths) to find which one the
23
+ Run `npx archik validate` (or check both paths) to find which one the
24
24
  project uses. Don't assume — small differences here matter.
25
25
 
26
26
  Treat the file as a shared vocabulary. It exists so the user and
27
27
  you can talk about the system without re-explaining it every time.
28
28
 
29
+ ## Hard rule: the CLI is the only interface to archik files
30
+
31
+ You MUST NOT use `Read`, `Write`, `Edit`, or any other file-touching
32
+ tool against `.archik/main.archik.yaml`, `architecture.archik.yaml`,
33
+ any `*.archik.yaml` sub-file, or any sidecar. The `npx archik` CLI is
34
+ the contract — it owns reads, writes, validation, and lifecycle.
35
+
36
+ | Need | Use |
37
+ | ----------------------------- | ----------------------------------------- |
38
+ | Inspect structure | `npx archik q ...` |
39
+ | Validate | `npx archik validate <path>` |
40
+ | Propose a change | `npx archik suggest set <draft>` |
41
+ | Apply / discard a suggestion | `npx archik suggest accept | reject` |
42
+ | Render or diff | `npx archik render` / `npx archik diff` |
43
+
44
+ `.archik/main.archik.yaml` is the user's source of truth — only
45
+ `npx archik suggest accept` is allowed to mutate it. The sidecar
46
+ `.archik/main.archik.suggested.yaml` is owned by the CLI too — only
47
+ `npx archik suggest set` (writes it) and `accept` / `reject`
48
+ (consumes it) may touch it.
49
+
50
+ If `npx archik` is unreachable (offline, sandboxed, missing), STOP
51
+ and tell the user. Do NOT fall back to reading or editing YAML by
52
+ hand — that breaks the contract and silently desyncs the canvas.
53
+
54
+ The user-facing slash commands (`/archik:suggest`,
55
+ `/archik:describe`, `/archik:accept`, `/archik:reject`,
56
+ `/archik:dev`) are thin shims over this same CLI. When a user types
57
+ `/archik:suggest <description>`, treat it as direct authorisation to
58
+ run the sidecar workflow now — skip the "want me to update the YAML?"
59
+ question.
60
+
29
61
  ## Protocol
30
62
 
31
63
  1. **Before** answering structural questions — *"what does X do?",
32
- "what depends on Y?", "where does data flow when …?"* — read
33
- the archik file. Don't guess from filenames or memory.
34
- 2. **When** work introduces, removes, or rewires components, write
35
- the proposed end-state to a sibling `*.suggested.yaml` next to
36
- the main file (same schema, plus a `metadata.suggestion` block —
37
- see "Suggesting changes" below). Don't edit the main file
38
- directly; the user reviews and accepts in the canvas or via
39
- `archik suggest accept`.
40
- 3. **After** every edit to a YAML, run `archik validate <path>`
41
- against the file you actually wrote — the canonical root file, a
42
- sidecar, or any sub-file under `.archik/`. Validate covers schema
43
- errors AND cross-file existence (`archikFile` / `fromFile` /
44
- `toFile` targets must be on disk). Fix every reported error before
45
- declaring the change done.
64
+ "what depends on Y?", "where does data flow when …?"* — query
65
+ the diagram with `npx archik q ...` (see CLI section). The CLI
66
+ walks the root file plus every `.archik/*.archik.yaml` sub-file
67
+ and returns focused, deterministic answers. Don't guess from
68
+ filenames or memory, and don't read the YAML directly — see the
69
+ hard rule above.
70
+ 2. **When** work introduces, removes, or rewires components, author
71
+ the proposed end-state in a workspace temp file (e.g.
72
+ `/tmp/archik-draft-<id>.yaml`) and stage it as the sidecar with
73
+ `npx archik suggest set <tmp> --note "<one-liner>"`. Do NOT
74
+ write `.archik/main.archik.suggested.yaml` directly — the CLI is
75
+ the only thing allowed to put files in `.archik/`. The user
76
+ reviews and accepts in the canvas or via
77
+ `npx archik suggest accept`.
78
+ 3. **After** every `suggest set`, the CLI has already validated for
79
+ you — schema, cross-file existence, the lot. If it exits non-zero,
80
+ fix the temp draft and re-run; never patch the sidecar directly.
81
+ For files outside `.archik/` (none, in a normal flow), use
82
+ `npx archik validate <path>`.
46
83
 
47
84
  The sections below are the detailed reference behind these three
48
85
  rules — *when* to consult, *when* to propose, schema, taxonomy,
@@ -55,16 +92,21 @@ The archik file tells you *what* exists. The source tree tells you
55
92
  the file is valuable — without it you just know there's "an Orders
56
93
  service" but not where to go to read or edit it. So:
57
94
 
58
- 1. **Read the archik file in full.** Use `archik validate` first to
59
- find the canonical path (it prefers `.archik/main.archik.yaml`,
60
- falls back to `architecture.archik.yaml`). Then `cat` it —
61
- don't grep, you want the whole shape in your head.
95
+ 1. **Pull the diagram shape from the CLI.** Don't `cat` the YAML —
96
+ use the query CLI:
97
+ ```
98
+ npx archik q stats # files, node and edge counts, kind histogram
99
+ npx archik q list # every node, with kind and parent
100
+ npx archik q edges # every edge, with relationship and endpoints
101
+ ```
102
+ That gives you the same picture as reading the file, without
103
+ touching it.
62
104
  2. **List the source tree.** A single `ls` of the top-level project
63
105
  directory plus the most likely source roots is usually enough:
64
- `ls -F . src/ services/ packages/ apps/ 2>/dev/null`. If the
65
- project has sub-architectures under `.archik/`, list those too
66
- (`ls .archik/`) — they're how the user breaks the diagram up by
67
- component.
106
+ `ls -F . src/ services/ packages/ apps/ 2>/dev/null`. (`ls
107
+ .archik/` is fine for *finding out which sub-architectures
108
+ exist*; don't open the YAMLs themselves — query them via
109
+ `npx archik q list --file <name>`.)
68
110
  3. **Build the mapping in your head.** Most projects follow one of
69
111
  two patterns: each top-level archik node id matches a folder
70
112
  under `src/` (or `services/` / `packages/`), or the `stack` /
@@ -81,74 +123,63 @@ service" but not where to go to read or edit it. So:
81
123
  When the user asks "where would I add X?" or "what's the right
82
124
  place for Y?", you should already have the answer because step 3
83
125
  gave it to you. When they ask "what would `archik render` show?",
84
- the answer is in step 1.
126
+ run `npx archik render --out /tmp/preview.svg` and describe it.
85
127
 
86
128
  ## Suggesting changes (the sidecar workflow)
87
129
 
88
- The archik file is the user's source of truth. You don't get to
89
- mutate it directly. Instead, write your proposed end-state to a
90
- sidecar file in the same directory, with the same stem plus
91
- `.suggested`:
130
+ The archik file is the user's source of truth. You don't mutate it
131
+ directly, and you don't write the sidecar directly either — both are
132
+ under `.archik/` and only the CLI is allowed to touch that
133
+ directory (see the hard rule).
92
134
 
93
- ```
94
- # new convention
95
- .archik/main.archik.yaml ← truth — user owns it
96
- .archik/main.archik.suggested.yaml ← your draft proposal
135
+ The flow is always the same:
97
136
 
98
- # legacy layout — same naming rule, just at the root
99
- architecture.archik.yaml
100
- architecture.archik.suggested.yaml
101
- ```
137
+ 1. Author the *full proposed end-state* document in a workspace temp
138
+ file outside `.archik/`. Pick a path like
139
+ `/tmp/archik-draft-<short-id>.yaml`.
140
+ 2. Run `npx archik suggest set <tmp> --note "<one-liner>"`. The CLI
141
+ parses, schema-validates, checks cross-file references, stamps
142
+ `metadata.suggestion`, and atomically renames the draft into
143
+ place as `.archik/main.archik.suggested.yaml` (or the legacy
144
+ `architecture.archik.suggested.yaml`).
145
+ 3. If `set` exits non-zero, fix the temp file based on the reported
146
+ errors and re-run. Never patch the sidecar with `Edit`/`Write`.
102
147
 
103
- The sidecar is a complete, valid Archik document — same schema as the
104
- main file, plus a `metadata.suggestion` block that marks it as a
105
- proposal:
148
+ A minimal draft looks exactly like a normal archik document — the
149
+ CLI fills in the suggestion marker for you, so you don't have to:
106
150
 
107
151
  ```yaml
108
152
  version: "1.0"
109
153
  name: My Architecture
110
- metadata:
111
- suggestion:
112
- from: .archik/main.archik.yaml
113
- at: 2026-04-26T17:00:00Z
114
- note: add Stripe payment flow # optional one-liner
115
154
  nodes:
116
155
  # ... entire proposed end-state, not just the delta
117
156
  edges:
118
157
  # ...
119
158
  ```
120
159
 
121
- Once you've written the sidecar:
160
+ Once `suggest set` has succeeded:
122
161
 
123
162
  * The canvas shows a **📝 Suggestion pending** banner with `Review`,
124
163
  `Accept`, `Reject` buttons. Review **toggles an in-canvas overlay
125
164
  on the same page** — added nodes/edges get green frames, removed
126
165
  ones get red dashed frames and dim out, changed ones get amber
127
- frames, and each gets a `+` / `−` / `~` badge. The button label
128
- flips to "Hide diff" while the overlay is on; click again to drop
129
- back to the regular view. Accept renames the sidecar over the main
130
- file; Reject deletes the sidecar. Both also clear review mode so
131
- the canvas snaps back to the new truth.
132
- * From the terminal: `archik suggest show | accept | reject`.
166
+ frames, and each gets a `+` / `−` / `~` badge. Accept renames the
167
+ sidecar over the main file; Reject deletes the sidecar.
168
+ * From the terminal: `npx archik suggest show | accept | reject`.
133
169
 
134
170
  If the user has no canvas open and asks "apply it", run
135
- `archik suggest accept` for them (only after they've explicitly
171
+ `npx archik suggest accept` for them (only after they've explicitly
136
172
  asked).
137
173
 
138
174
  **Key rules:**
139
175
 
140
176
  * Write the *full proposed document*, not a patch. The diff is
141
177
  computed by archik between the main file and the sidecar.
142
- * Run `archik validate <sidecar-path>` after writing — that's
143
- `.archik/main.archik.suggested.yaml` under the new layout, or
144
- `architecture.archik.suggested.yaml` under the legacy one. Validate
145
- catches schema errors (dangling edges, parent cycles, duplicate
146
- ids) AND missing cross-file targets (`archikFile` / `fromFile` /
147
- `toFile` resolved against the project root). Silent failures are
148
- not OK — re-edit and re-run until it passes.
149
- * If a suggestion sidecar already exists, treat it as your previous
150
- proposal — extend or replace it. Don't write a new sidecar with a
151
- different name.
178
+ * Don't call `Write`/`Edit` against `.archik/main.archik.suggested.yaml`
179
+ or any peer file under `.archik/`. The CLI owns that directory.
180
+ * If a suggestion sidecar already exists, `npx archik suggest set`
181
+ overwrites it. Tell the user you're replacing their previous
182
+ pending suggestion.
152
183
 
153
184
  ## When to consult the YAML
154
185
 
@@ -189,7 +220,7 @@ The YAML tracks **shape**, not implementation detail.
189
220
 
190
221
  ## Hard rules for editing
191
222
 
192
- The schema enforces these — `archik validate` will reject the file
223
+ The schema enforces these — `npx archik validate` will reject the file
193
224
  if you break any of them, so don't bother trying.
194
225
 
195
226
  - **Never put coordinates** (`x`, `y`, `width`, `height`, `viewport`) in
@@ -274,7 +305,7 @@ Constraints (the schema enforces them):
274
305
  forward slashes, no `..`, ends in `.archik.yaml`).
275
306
  - The path is resolved against the **project root** (parent of
276
307
  `.archik/` under the new layout, the doc's own directory under the
277
- legacy one) — same rule as `archikFile`. `archik validate` exits
308
+ legacy one) — same rule as `archikFile`. `npx archik validate` exits
278
309
  1 if the file isn't on disk.
279
310
  - The *local* endpoint id must still match a node in this file.
280
311
  - An edge with **both** `fromFile` and `toFile` is rejected — author
@@ -297,7 +328,7 @@ Constraints (the schema enforces them):
297
328
  - **Resolved against the project root**, not the file's own
298
329
  directory. With the new layout the project root is the parent of
299
330
  `.archik/`, so a sibling sub-file is `.archik/orders.archik.yaml`
300
- (with the prefix), NOT `orders.archik.yaml`. `archik validate`
331
+ (with the prefix), NOT `orders.archik.yaml`. `npx archik validate`
301
332
  exits 1 if the target file isn't on disk — catch it there instead
302
333
  of as a 404 in the canvas.
303
334
  - Cycles aren't checked at parse time (each file validates on its
@@ -601,51 +632,106 @@ edges:
601
632
 
602
633
  ## CLI
603
634
 
604
- These commands are available globally if archik was installed via
605
- `npm link`. Without a positional path, each command resolves the
606
- archik file in this order: `.archik/main.archik.yaml` (preferred),
607
- then `architecture.archik.yaml` (legacy). If both exist the
608
- command errors and asks the user to pick one.
635
+ The CLI is the agent-friendly bridge to archik. Prefer it over
636
+ re-reading the YAML when answering structural questions — the answers
637
+ are deterministic, focused, and don't pollute your context with the
638
+ whole diagram.
639
+
640
+ ### Running the CLI
641
+
642
+ The CLI ships as the `archik` npm package. Two equivalent ways to
643
+ invoke any command:
609
644
 
610
645
  ```
611
- archik validate # schema check (run after every edit)
612
- archik validate path/to/file.yaml
613
- archik render --out diagram.svg # headless layout → SVG
614
- archik render --theme light --out diagram-light.svg
615
- archik diff a.yaml b.yaml # text + colour-coded SVG diff
616
- archik diff a.yaml b.yaml --out diff.svg
617
- archik suggest show # summary of pending sidecar (default)
618
- archik suggest accept # apply the sidecar over the main file
619
- archik suggest reject # discard the sidecar
620
- archik watch # re-render SVG on save
621
- archik dev # open the live editor in the browser (foreground)
622
- archik start # same as dev, detached — returns the prompt
623
- archik stop # stop the background server
624
- archik status # list running archik instances
625
- archik init # scaffold a starter file (also installs this skill into ./.claude/skills/archik/ unless --no-skill)
626
- archik skill # install/refresh this skill in cwd
646
+ npx archik <command> # works without installing — caches after first use
647
+ archik <command> # if the user has run `npm i -g archik`
627
648
  ```
628
649
 
629
- If `archik` isn't on PATH (the user hasn't run `npm link` yet), fall
630
- back to the in-repo form: `npm run archik -- <command>` from the
631
- archik checkout.
650
+ **Default to `npx archik` in your suggestions and shell calls.** It
651
+ just works in fresh repos, doesn't require a global install, and
652
+ falls through to the cached binary on subsequent runs. Suggest
653
+ `npm i -g archik` only when the user wants the live canvas
654
+ (`archik dev`) on a fast keystroke.
655
+
656
+ If neither form is reachable (offline, sandboxed shell), fall back to
657
+ reading the YAML directly with the same schema documented above —
658
+ the file is always the source of truth.
659
+
660
+ ### Without a positional path
661
+
662
+ Every read command resolves the archik file in this order:
663
+ `.archik/main.archik.yaml` (preferred), then
664
+ `architecture.archik.yaml` (legacy). If both exist the command errors
665
+ and asks the user to pick one.
666
+
667
+ ### Querying the diagram (use this for structural questions)
668
+
669
+ ```
670
+ npx archik q describe <id> # node + its incoming/outgoing edges
671
+ npx archik q deps <id> # outgoing edges (what this node uses)
672
+ npx archik q dependents <id> # incoming edges (what uses this node)
673
+ npx archik q list # all nodes
674
+ --kind <k> # filter by kind (service, function, …)
675
+ --parent <id> # filter by container
676
+ --file <p> # filter by file (substring match)
677
+ npx archik q edges # all edges
678
+ --from <id> # filter by source
679
+ --to <id> # filter by target
680
+ --rel <name> # filter by relationship
681
+ npx archik q impact <id> # what would break if this node were removed
682
+ npx archik q stats # files, nodes, edges, kind histogram
683
+ ```
684
+
685
+ Add `--json` to any `q` subcommand for a stable machine-readable
686
+ shape (object on stdout). Exit codes: `0` found, `1` empty / unknown
687
+ id, `2` could not load. Walks the root file plus every
688
+ `.archik/*.archik.yaml` sub-file. Cross-file id collisions error
689
+ rather than silently picking — surface the ambiguity.
690
+
691
+ ### Authoring & lifecycle
692
+
693
+ ```
694
+ npx archik validate # schema + cross-file existence (CI-friendly, exit 1 on error)
695
+ npx archik validate --json # structured { ok, file, nodes, edges, errors }
696
+ npx archik render --out diagram.svg
697
+ --theme light # "dark" (default) or "light"
698
+ npx archik diff a.yaml b.yaml # text summary
699
+ npx archik diff a.yaml b.yaml --out diff.svg
700
+ npx archik diff a.yaml b.yaml --json
701
+ npx archik suggest show # summary of pending sidecar (default)
702
+ --json # structured output
703
+ npx archik suggest set <draft> # validate a draft YAML and stage it as the sidecar
704
+ --note '<text>' # set metadata.suggestion.note
705
+ --main <path> # override main file detection
706
+ --json # structured output
707
+ - # draft path "-" reads from stdin
708
+ npx archik suggest accept # apply the sidecar over the main file
709
+ npx archik suggest reject # discard the sidecar
710
+ npx archik watch # re-render SVG on save
711
+ npx archik dev # open the live editor in the browser
712
+ npx archik start | stop | status # detached canvas server lifecycle
713
+ npx archik init # scaffold a starter file + install skill + slash commands
714
+ npx archik skill # install/refresh the Claude skill in cwd
715
+ npx archik commands # install/refresh the /archik:* slash commands in cwd
716
+ ```
632
717
 
633
718
  ## Verification workflow
634
719
 
635
- After **every** edit you make to an archik file (root, sidecar, or
636
- sub-file):
637
-
638
- 1. Run `archik validate <path>` against the file you wrote. Validate
639
- covers schema errors (with the field path so you can fix them
640
- precisely) AND cross-file existence — `archikFile`, `fromFile`,
641
- and `toFile` are resolved against the project root and the
642
- command exits 1 if the target file isn't on disk. Fix every
643
- reported error before declaring the change done.
644
- 2. If the project has an `archik dev` server running, the file watcher
645
- broadcasts the change automatically — no restart needed.
646
- 3. If the project commits a rendered SVG (e.g. `docs/architecture.svg`),
647
- regenerate it with `archik render --out docs/architecture.svg` so
648
- the committed picture matches the YAML.
720
+ After **every** `npx archik suggest set` or `npx archik suggest
721
+ accept`:
722
+
723
+ 1. The CLI has already validated the schema and cross-file references
724
+ for you — `set` refuses to write a broken sidecar, `accept` runs
725
+ over a sidecar that was validated when it was staged. If `set`
726
+ reported errors, fix them in the temp draft and re-run; never
727
+ reach for `Write`/`Edit` on the sidecar.
728
+ 2. If the project has an `archik dev` server running, the file
729
+ watcher broadcasts the change to the canvas automatically — no
730
+ restart needed. Surface the URL so the user can click through.
731
+ 3. If the project commits a rendered SVG (e.g.
732
+ `docs/architecture.svg`), regenerate it with `npx archik render
733
+ --out docs/architecture.svg` so the committed picture matches the
734
+ YAML.
649
735
 
650
736
  ## Things to avoid
651
737
 
package/README.md CHANGED
@@ -90,30 +90,36 @@ No `x` / `y` / `width` — layout is computed by [ELK](https://eclipse.dev/elk/)
90
90
  - **12 relationships** with distinct visual styling — `http_call`, `invokes`, `reads`, `writes`, `publishes`, `subscribes`, `streams_to`, `routes_to`, `implements`, `depends_on`, `has_a`, `uses`.
91
91
  - **Drag-to-connect, multi-select, undo/redo, compact view, themed (dark / light), notes per node, color overrides on edges.**
92
92
  - **CI-ready CLI** — `validate`, `render` (headless SVG), `watch`, `check` (drift between YAML and source dirs).
93
- - **AI skill** — `archik skill --user` installs a Claude Code skill that teaches Claude the schema, the protocol, and the verification workflow.
93
+ - **AI skill + slash commands** — `archik skill --user` installs the Claude Code skill; `archik commands --user` installs `/archik:suggest`, `/archik:accept`, `/archik:reject`, `/archik:describe`, and `/archik:dev` so Claude drives the diagram entirely through the CLI.
94
94
 
95
95
  ## For Claude Code & other LLMs
96
96
 
97
97
  The whole reason Archik uses YAML instead of a binary format: **the file is the shared map between you and the model**. Run:
98
98
 
99
99
  ```bash
100
- archik skill --user # install once into ~/.claude/skills
100
+ archik skill --user # install the skill into ~/.claude/skills
101
+ archik commands --user # install the /archik:* slash commands into ~/.claude/commands
101
102
  ```
102
103
 
103
- …and Claude Code in any project gets the right vocabulary automatically. The skill defines a 3-rule protocol:
104
+ (Or just `archik init` in a fresh project — both land automatically.)
104
105
 
105
- 1. **Read** `architecture.archik.yaml` before answering structural questions.
106
- 2. **Propose** YAML updates whenever new work introduces or rewires components.
107
- 3. **Run `archik validate`** after every edit to fail fast on schema errors.
106
+ The skill enforces a hard rule: **Claude interacts with archik only through the `npx archik` CLI** — never `Read`, `Write`, or `Edit` on a YAML directly. Queries go through `npx archik q`, suggestions through `npx archik suggest set`, lifecycle through `npx archik suggest accept | reject`. The user owns the file; the CLI is the contract.
108
107
 
109
- So conversations like *"add a payments worker that subscribes to the orders queue"* end with both the code change **and** the matching YAML diff — kept in sync without anyone having to remember.
108
+ Day-to-day this looks like:
109
+
110
+ ```
111
+ /archik:suggest add a payments worker that subscribes to the orders queue
112
+ ```
113
+
114
+ Claude grounds itself with `npx archik q stats`, drafts a full proposal in a temp file, runs `npx archik suggest set` to stage it as the canonical sidecar, and surfaces the canvas URL so you can review the diff overlay and Accept/Reject in the browser. No manual YAML edits, no chance of the canvas and the file disagreeing.
110
115
 
111
116
  ## Commands
112
117
 
113
118
  ```
114
119
  archik init [path] Scaffold a starter .archik/main.archik.yaml
115
- (also installs the Claude skill by default)
120
+ (also installs the Claude skill + /archik:* slash commands by default)
116
121
  --no-skill skip installing the Claude skill
122
+ --no-commands skip installing the /archik:* slash commands
117
123
 
118
124
  archik dev [path] Open the canvas in your browser (foreground, Ctrl+C to stop)
119
125
  archik start [path] Same as dev, but detached — prompt returns immediately
@@ -130,9 +136,22 @@ archik render [path] Render to a self-contained SVG file
130
136
  --theme <name> "dark" (default) or "light"
131
137
  archik watch [path] Re-render to SVG on every file change (Ctrl+C to stop)
132
138
 
139
+ archik suggest [sub] Manage Claude's pending architecture suggestion
140
+ show summarise the pending sidecar (default; --json supported)
141
+ set <draft> validate a draft YAML and stage it as the sidecar
142
+ --note '<text>' set metadata.suggestion.note
143
+ --main <path> override main file detection
144
+ --json structured output
145
+ - read draft from stdin
146
+ accept apply the sidecar over the main file
147
+ reject discard the sidecar
148
+
133
149
  archik skill Install the Claude skill for AI editing
134
150
  --user install into ~/.claude/skills (all projects)
135
151
  --force overwrite an existing skill
152
+ archik commands Install the /archik:* slash commands for Claude Code
153
+ --user install into ~/.claude/commands (all projects)
154
+ --force overwrite existing commands
136
155
  ```
137
156
 
138
157
  Without a `[path]` argument, archik resolves the file in this order: