archik 0.7.0 → 0.7.2
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/.claude/commands/archik/accept.md +1 -1
- package/.claude/commands/archik/describe.md +1 -1
- package/.claude/commands/archik/dev.md +1 -1
- package/.claude/commands/archik/evolve.md +136 -0
- package/.claude/commands/archik/reject.md +1 -1
- package/.claude/commands/archik/spawn.md +164 -0
- package/.claude/commands/archik/suggest.md +20 -14
- package/.claude/skills/archik/SKILL.md +26 -6
- package/README.md +53 -19
- package/dist/cli/archik.mjs +474 -232
- package/dist/ui/assets/{index-BAIgFELp.js → index-4lFOVG8E.js} +63 -63
- package/dist/ui/assets/index-s04yHjLy.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/ui/assets/index-UZ_JijeQ.css +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Propose a cleaner modular refactor
|
|
3
|
+
argument-hint: [optional focus area]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /archik:evolve — propose a cleaner, bounded architecture
|
|
7
|
+
|
|
8
|
+
The user wants you to look at the current diagram with a critical
|
|
9
|
+
eye and **propose a refactor toward a cleaner modular architecture
|
|
10
|
+
with clear bounded contexts**. Stage the proposal as a sidecar so
|
|
11
|
+
the diff overlay highlights what would change, then **wait for the
|
|
12
|
+
user to discuss before they accept** — evolve is a conversation,
|
|
13
|
+
not a one-shot.
|
|
14
|
+
|
|
15
|
+
If `$ARGUMENTS` is non-empty, treat it as the area to focus on
|
|
16
|
+
(e.g. *"payments domain"*, *"the orders module"*, *"async wiring
|
|
17
|
+
between services"*). If empty, evaluate the whole diagram.
|
|
18
|
+
|
|
19
|
+
## CLI-only — do not touch archik files directly
|
|
20
|
+
|
|
21
|
+
You MUST interact with archik exclusively through the `npx archik`
|
|
22
|
+
CLI. Drafts go to a workspace temp file, then `npx archik suggest
|
|
23
|
+
set` stages them. Do NOT use `Read`, `Write`, or `Edit` against
|
|
24
|
+
any file under `.archik/`.
|
|
25
|
+
|
|
26
|
+
## Steps
|
|
27
|
+
|
|
28
|
+
1. **Make sure the canvas is running**: `npx archik status` →
|
|
29
|
+
`npx archik start` if needed. Note the URL for step 6.
|
|
30
|
+
|
|
31
|
+
2. **Ground yourself in the current shape** via the query CLI:
|
|
32
|
+
```
|
|
33
|
+
npx archik q stats
|
|
34
|
+
npx archik q list
|
|
35
|
+
npx archik q edges
|
|
36
|
+
```
|
|
37
|
+
If `$ARGUMENTS` names a specific area, also:
|
|
38
|
+
```
|
|
39
|
+
npx archik q describe <id>
|
|
40
|
+
npx archik q deps <id>
|
|
41
|
+
npx archik q dependents <id>
|
|
42
|
+
npx archik q impact <id>
|
|
43
|
+
```
|
|
44
|
+
Refuse politely and stop if the diagram has fewer than 3 nodes
|
|
45
|
+
— there's nothing meaningful to evolve. Suggest `/archik:spawn`
|
|
46
|
+
first.
|
|
47
|
+
|
|
48
|
+
3. **Identify smells and missing structure.** Don't propose change
|
|
49
|
+
for change's sake — every modification should fix one of:
|
|
50
|
+
|
|
51
|
+
- **Bounded contexts unclear.** Several services share a
|
|
52
|
+
domain language but aren't grouped → wrap in a `module`
|
|
53
|
+
container per context.
|
|
54
|
+
- **God service.** One node owns too many responsibilities or
|
|
55
|
+
reaches into too many domains → split along bounded
|
|
56
|
+
contexts, with the original kept only as the API surface
|
|
57
|
+
facing the outside.
|
|
58
|
+
- **Leaky boundaries.** Cross-context `reads` / `writes`
|
|
59
|
+
directly on another context's database → introduce a `port`
|
|
60
|
+
+ `adapter` pair, or replace with `publishes` / `subscribes`
|
|
61
|
+
events.
|
|
62
|
+
- **Missing hexagonal structure** at external boundaries.
|
|
63
|
+
Direct `http_call` to Stripe / OpenAI / payment processor →
|
|
64
|
+
introduce a `port` (the abstract contract) and an `adapter`
|
|
65
|
+
(the concrete impl), with `implements` between them.
|
|
66
|
+
- **Cyclic dependencies** between modules — should be inverted
|
|
67
|
+
(events) or broken (extract shared kernel).
|
|
68
|
+
- **Anaemic queues.** Two services connected by `http_call`
|
|
69
|
+
for what's clearly an async fire-and-forget → introduce a
|
|
70
|
+
`queue` or `topic` and rewire to `publishes` / `subscribes`.
|
|
71
|
+
|
|
72
|
+
Aim for 3–8 changes — enough to be meaningful, few enough that
|
|
73
|
+
the user can reason about each. If you'd need more, propose
|
|
74
|
+
the highest-impact subset and tell the user the rest is round
|
|
75
|
+
two.
|
|
76
|
+
|
|
77
|
+
4. **Author + stage in one step.** Pipe the full proposed
|
|
78
|
+
end-state directly into `npx archik suggest set -` via a
|
|
79
|
+
heredoc — no temp files, no `/tmp/` paths:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx archik suggest set --note "evolve: <one-line summary>" - <<'YAML'
|
|
83
|
+
version: "1.0"
|
|
84
|
+
name: My Architecture
|
|
85
|
+
nodes:
|
|
86
|
+
# full proposed end-state — every node, not just the delta
|
|
87
|
+
edges:
|
|
88
|
+
# ...
|
|
89
|
+
YAML
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Constraints when authoring the YAML:
|
|
93
|
+
- Preserve every existing node id you keep — only add or remove
|
|
94
|
+
ids, never rename. Renames break diff and require the user to
|
|
95
|
+
manually re-link references in code.
|
|
96
|
+
- Don't drop `description`, `responsibilities`, or `notes`
|
|
97
|
+
fields the user authored. Carry them over verbatim.
|
|
98
|
+
- Every change should be motivated by step 3, not by aesthetics.
|
|
99
|
+
|
|
100
|
+
If `suggest set` reports validation errors, re-run with the
|
|
101
|
+
corrected YAML. Never patch the sidecar directly.
|
|
102
|
+
|
|
103
|
+
5. **Open the discussion.** Print, in this order:
|
|
104
|
+
|
|
105
|
+
a. The canvas URL with: *"📝 Evolved diagram staged — open
|
|
106
|
+
<URL> and toggle Review to see green / red / amber overlays."*
|
|
107
|
+
b. A numbered, plain-English summary of the proposed changes,
|
|
108
|
+
grouped by motivation (e.g. *"1. Extract a `payments`
|
|
109
|
+
bounded context from `orders`. Why: payment logic was leaking
|
|
110
|
+
into order placement…"*). Keep each item to 2–3 sentences.
|
|
111
|
+
c. An explicit invitation: *"Tell me what you'd like to keep,
|
|
112
|
+
drop, or rework before you accept. I can re-stage with
|
|
113
|
+
changes — `/archik:accept` is whenever you're ready."*
|
|
114
|
+
|
|
115
|
+
**Do NOT auto-accept.** Even if the user said "evolve and apply"
|
|
116
|
+
in shorthand, evolve always stops at the staged sidecar so the
|
|
117
|
+
diff is reviewable.
|
|
118
|
+
|
|
119
|
+
## Iterating
|
|
120
|
+
|
|
121
|
+
If the user pushes back on specific items ("keep the orders
|
|
122
|
+
service whole; only fix the Stripe integration"), re-run
|
|
123
|
+
`npx archik suggest set -` with the revised YAML — it overwrites
|
|
124
|
+
the previous sidecar. Acknowledge what you changed
|
|
125
|
+
since the last round so the user doesn't have to re-read the
|
|
126
|
+
whole diff.
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- Evolve is bounded-context-aware but doesn't blindly apply DDD.
|
|
131
|
+
If the project is genuinely small and a single service is the
|
|
132
|
+
right answer, say so and stage no changes — better than
|
|
133
|
+
inventing structure for its own sake.
|
|
134
|
+
- If you'd need to look at code (not just the diagram) to make a
|
|
135
|
+
responsible recommendation, say so up front and ask for
|
|
136
|
+
permission to read specific files. Don't silently expand scope.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Mirror the source tree as a diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /archik:spawn — mirror the codebase as an archik diagram
|
|
6
|
+
|
|
7
|
+
The user wants a first-pass archik diagram that **reflects the
|
|
8
|
+
project as it actually is right now**, not as it should be. Read
|
|
9
|
+
the source tree, infer the components and the wiring, stage the
|
|
10
|
+
result as a suggestion sidecar so the user can review it on the
|
|
11
|
+
canvas before accepting.
|
|
12
|
+
|
|
13
|
+
Use `/archik:evolve` afterwards if they want a cleaner version.
|
|
14
|
+
Spawn = mirror. Evolve = improve.
|
|
15
|
+
|
|
16
|
+
## CLI-only — do not touch archik files directly
|
|
17
|
+
|
|
18
|
+
You MUST interact with archik exclusively through the `npx archik`
|
|
19
|
+
CLI. Do NOT use `Read`, `Write`, or `Edit` on any file under
|
|
20
|
+
`.archik/`. Your draft goes to a workspace temp file, then `npx
|
|
21
|
+
archik suggest set` stages it.
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
1. **Make sure the canvas is running** so the user can review:
|
|
26
|
+
```
|
|
27
|
+
npx archik status
|
|
28
|
+
```
|
|
29
|
+
If nothing is running, start it detached: `npx archik start`.
|
|
30
|
+
Note the URL.
|
|
31
|
+
|
|
32
|
+
2. **Check what's already there** — if the project already has a
|
|
33
|
+
meaningful archik file, this command will *replace* it via the
|
|
34
|
+
suggestion workflow. Confirm with the user before proceeding
|
|
35
|
+
when the diagram has substance:
|
|
36
|
+
```
|
|
37
|
+
npx archik q stats
|
|
38
|
+
```
|
|
39
|
+
- 0 nodes / starter scaffold (web + api + db, the `archik init`
|
|
40
|
+
default) → proceed silently.
|
|
41
|
+
- Real content → tell the user "I'm about to replace the
|
|
42
|
+
current diagram with a fresh one mirroring the source tree —
|
|
43
|
+
this will produce a sidecar you can review or reject. Want me
|
|
44
|
+
to continue?" Wait for confirmation.
|
|
45
|
+
|
|
46
|
+
3. **Map the source tree.** Walk the project from cwd, paying
|
|
47
|
+
attention to conventional layouts. Don't recurse into
|
|
48
|
+
`node_modules`, `dist`, `build`, `.git`, `.next`,
|
|
49
|
+
`target`, `venv`, `.venv`, or `vendor`.
|
|
50
|
+
|
|
51
|
+
Useful signals (apply only if they fit the project — never
|
|
52
|
+
invent structure):
|
|
53
|
+
- **Top-level dirs**: `apps/`, `services/`, `packages/`, `src/`,
|
|
54
|
+
`cmd/`, `internal/`, `lambdas/`, `workers/`, `agents/`.
|
|
55
|
+
Each child usually maps to one node.
|
|
56
|
+
- **Manifest files**: `package.json` `name`, `Cargo.toml`,
|
|
57
|
+
`go.mod`, `pyproject.toml` give canonical component names.
|
|
58
|
+
- **`README` / `description`**: pull a one-line summary if
|
|
59
|
+
present; otherwise omit `description` rather than fabricate.
|
|
60
|
+
- **Stack hints**: `package.json` deps (Next.js, Express, Fastify,
|
|
61
|
+
Hono → service/frontend), `go.mod`, `requirements.txt`,
|
|
62
|
+
`Gemfile`. Set `stack` only when the signal is clear.
|
|
63
|
+
- **Datastores**: a `migrations/` folder, a `schema.sql`,
|
|
64
|
+
`prisma/`, `drizzle/`, `flyway/`, references to Postgres /
|
|
65
|
+
MySQL / Redis / Mongo / S3 / Pinecone / pgvector in deps or
|
|
66
|
+
env files → corresponding `database` / `cache` / `vectordb` /
|
|
67
|
+
`storage` node.
|
|
68
|
+
- **Queues / streams**: SQS / RabbitMQ / Kafka / Kinesis client
|
|
69
|
+
deps or config → `queue` / `topic` / `stream` node.
|
|
70
|
+
- **External APIs**: Stripe, OpenAI, Anthropic, Twilio, GitHub
|
|
71
|
+
SDKs in deps → `external` (or `llm` for OpenAI / Anthropic)
|
|
72
|
+
nodes.
|
|
73
|
+
- **Frontends**: `apps/web`, `apps/mobile`, `client/`,
|
|
74
|
+
`packages/ui` apps that ship a UI → `frontend`.
|
|
75
|
+
|
|
76
|
+
4. **Choose the kind for each node.** Default: `service`. Use the
|
|
77
|
+
taxonomy from the skill — `function` for serverless, `worker`
|
|
78
|
+
for background consumers, `agent` for LLM-driven agents, etc.
|
|
79
|
+
When unsure, pick the closest fit and add a `notes:` entry
|
|
80
|
+
explaining the inference rather than picking `custom`.
|
|
81
|
+
|
|
82
|
+
5. **Nest by structure**, mirroring the directories.
|
|
83
|
+
- Top-level grouping dir (e.g. `services/`) → a `module` container.
|
|
84
|
+
- Each child dir → a node with `parentId` pointing at the container.
|
|
85
|
+
- If a node has substantial internal structure (e.g.
|
|
86
|
+
`services/orders/{api,domain,db}`), emit a stub
|
|
87
|
+
`archikFile: .archik/<id>.archik.yaml` and *also* draft that
|
|
88
|
+
sub-file. Don't nest beyond two levels in the main file —
|
|
89
|
+
drill-down is what `archikFile` is for.
|
|
90
|
+
|
|
91
|
+
6. **Wire the edges.** Be conservative — only add an edge when you
|
|
92
|
+
have actual evidence:
|
|
93
|
+
- Cross-package imports → `depends_on` or a more specific
|
|
94
|
+
relationship (`uses`, `invokes`).
|
|
95
|
+
- HTTP route handlers calling another service's endpoint →
|
|
96
|
+
`http_call`.
|
|
97
|
+
- DB client usage → `reads` / `writes`.
|
|
98
|
+
- Queue producer / consumer code → `publishes` / `subscribes`.
|
|
99
|
+
- Webhook handlers (e.g. `/webhooks/stripe`) → `webhook` from
|
|
100
|
+
the external node.
|
|
101
|
+
|
|
102
|
+
When in doubt, leave the edge out. The user will add it via
|
|
103
|
+
`/archik:suggest` later.
|
|
104
|
+
|
|
105
|
+
7. **Stage the draft.** Pipe the YAML straight into `npx archik
|
|
106
|
+
suggest set -` via a heredoc — no temp files, no `/tmp/` paths.
|
|
107
|
+
Sub-files come first because the main draft references them via
|
|
108
|
+
`archikFile`, and `suggest set` validates that those targets
|
|
109
|
+
exist on disk.
|
|
110
|
+
|
|
111
|
+
a. **Each sub-file**: the parent file doesn't exist yet, so
|
|
112
|
+
pass `--allow-orphan` to opt in to writing a sidecar for a
|
|
113
|
+
missing main. Then accept it so the file lands at
|
|
114
|
+
`.archik/<id>.archik.yaml`:
|
|
115
|
+
```bash
|
|
116
|
+
npx archik suggest set --main .archik/<id>.archik.yaml \
|
|
117
|
+
--allow-orphan \
|
|
118
|
+
--note "spawn: <id> internals" - <<'YAML'
|
|
119
|
+
version: "1.0"
|
|
120
|
+
name: <Id> Internals
|
|
121
|
+
nodes: [ ... ]
|
|
122
|
+
edges: [ ... ]
|
|
123
|
+
YAML
|
|
124
|
+
npx archik suggest accept .archik/<id>.archik.yaml
|
|
125
|
+
```
|
|
126
|
+
Repeat for every sub-file. The `accept` step is what makes
|
|
127
|
+
the file real on disk — without it the orphan sidecar lingers
|
|
128
|
+
and the canvas shows it as "(pending)" rather than rendering it.
|
|
129
|
+
|
|
130
|
+
b. **Main draft**: once all sub-files exist (i.e. their
|
|
131
|
+
`accept`s succeeded), stage the main one. No `--allow-orphan`
|
|
132
|
+
needed because the main file already exists from `archik init`:
|
|
133
|
+
```bash
|
|
134
|
+
npx archik suggest set --note "spawn: mirror source tree" - <<'YAML'
|
|
135
|
+
version: "1.0"
|
|
136
|
+
name: My Architecture
|
|
137
|
+
nodes:
|
|
138
|
+
# full proposed end-state, with archikFile pointers
|
|
139
|
+
edges:
|
|
140
|
+
# ...
|
|
141
|
+
YAML
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
c. If `suggest set` reports validation errors, re-run with the
|
|
145
|
+
corrected YAML. Never edit the sidecar by hand.
|
|
146
|
+
|
|
147
|
+
8. **Tell the user how to review.** Surface the canvas URL plus:
|
|
148
|
+
- "📝 Initial diagram staged from source tree — open the
|
|
149
|
+
canvas at <URL> and use Review to see the proposed nodes."
|
|
150
|
+
- "Looks wrong? Run `/archik:reject` and we'll iterate. Or run
|
|
151
|
+
`/archik:evolve` after accepting if you want a cleaner
|
|
152
|
+
bounded-context version."
|
|
153
|
+
|
|
154
|
+
## Notes
|
|
155
|
+
|
|
156
|
+
- Spawn is descriptive, not prescriptive. Don't reorganize, split,
|
|
157
|
+
or merge components — just mirror what's there. Cleanup is
|
|
158
|
+
`/archik:evolve`'s job.
|
|
159
|
+
- Don't fabricate edges to fill gaps in the diagram. An incomplete
|
|
160
|
+
but accurate diagram is more useful than a complete-looking but
|
|
161
|
+
wrong one.
|
|
162
|
+
- If the source tree is one big monolith with no obvious
|
|
163
|
+
decomposition, output a single node and tell the user — don't
|
|
164
|
+
invent fake sub-services.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Propose
|
|
2
|
+
description: Propose a diagram change
|
|
3
3
|
argument-hint: <feature description>
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -43,22 +43,28 @@ the contract with the user.
|
|
|
43
43
|
If `$ARGUMENTS` mentions a specific node by name, also run
|
|
44
44
|
`npx archik q describe <id>` for it.
|
|
45
45
|
|
|
46
|
-
3. **Author
|
|
47
|
-
|
|
48
|
-
The
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
3. **Author + stage in one step.** Pipe the draft straight into
|
|
47
|
+
`npx archik suggest set -` via a heredoc — no temp file, no
|
|
48
|
+
`/tmp/` paths. The CLI validates the schema, checks cross-file
|
|
49
|
+
references, stamps `metadata.suggestion`, and atomically writes
|
|
50
|
+
`.archik/main.archik.suggested.yaml`:
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
```bash
|
|
53
|
+
npx archik suggest set --note "$ARGUMENTS" - <<'YAML'
|
|
54
|
+
version: "1.0"
|
|
55
|
+
name: My Architecture
|
|
56
|
+
nodes:
|
|
57
|
+
# full proposed end-state — every node, not just the delta
|
|
58
|
+
edges:
|
|
59
|
+
# full proposed end-state — every edge, not just the delta
|
|
60
|
+
YAML
|
|
53
61
|
```
|
|
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
62
|
|
|
61
|
-
|
|
63
|
+
If the command exits non-zero, re-run with the corrected YAML.
|
|
64
|
+
Never write a draft file under `.archik/` and never edit the
|
|
65
|
+
sidecar directly.
|
|
66
|
+
|
|
67
|
+
4. **Tell the user how to review**. Surface the canvas URL from
|
|
62
68
|
step 1 plus the terminal options:
|
|
63
69
|
- "📝 Suggestion ready — open the canvas at <URL> and use the
|
|
64
70
|
**Review** banner to see added/removed/changed nodes."
|
|
@@ -51,12 +51,32 @@ If `npx archik` is unreachable (offline, sandboxed, missing), STOP
|
|
|
51
51
|
and tell the user. Do NOT fall back to reading or editing YAML by
|
|
52
52
|
hand — that breaks the contract and silently desyncs the canvas.
|
|
53
53
|
|
|
54
|
-
The user-facing slash commands
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
The user-facing slash commands are thin shims over this same CLI:
|
|
55
|
+
|
|
56
|
+
| Command | Purpose |
|
|
57
|
+
| ---------------------- | --------------------------------------------- |
|
|
58
|
+
| `/archik:spawn` | Bootstrap a diagram from the source tree |
|
|
59
|
+
| `/archik:evolve` | Propose a cleaner bounded-context refactor |
|
|
60
|
+
| `/archik:suggest <…>` | Propose changes from a feature description |
|
|
61
|
+
| `/archik:describe <id>`| Explain a node and its connections |
|
|
62
|
+
| `/archik:accept` | Apply the pending suggestion |
|
|
63
|
+
| `/archik:reject` | Discard the pending suggestion |
|
|
64
|
+
| `/archik:dev` | Start the live canvas |
|
|
65
|
+
|
|
66
|
+
When a user types `/archik:suggest <description>`, `/archik:spawn`,
|
|
67
|
+
or `/archik:evolve`, treat it as direct authorisation to run the
|
|
68
|
+
sidecar workflow now — skip the "want me to update the YAML?"
|
|
69
|
+
question. Each command's body file under `.claude/commands/archik/`
|
|
70
|
+
has the detailed protocol for that specific verb; follow it.
|
|
71
|
+
|
|
72
|
+
Three things separate the proposal commands:
|
|
73
|
+
|
|
74
|
+
- **`spawn`** is *descriptive* — mirror the source tree as it is.
|
|
75
|
+
- **`evolve`** is *prescriptive* — propose a cleaner shape, then
|
|
76
|
+
wait for the user to discuss before they accept. Never
|
|
77
|
+
auto-accepts.
|
|
78
|
+
- **`suggest`** is *targeted* — apply one feature-sized change
|
|
79
|
+
from a user description.
|
|
60
80
|
|
|
61
81
|
## Protocol
|
|
62
82
|
|
package/README.md
CHANGED
|
@@ -26,10 +26,11 @@ queues, agents, LLMs, the edges between them. Plain YAML, schema-
|
|
|
26
26
|
validated, no coordinates, no proprietary format.
|
|
27
27
|
|
|
28
28
|
Open it in your browser for a live canvas. Render it in CI for a
|
|
29
|
-
self-contained SVG.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
self-contained SVG. The [Claude Code skill and `/archik:*` slash
|
|
30
|
+
commands](#for-claude-code--other-llms) install automatically with
|
|
31
|
+
`archik init`, so the model edits the same file you do — *the
|
|
32
|
+
diagram and the codebase stop drifting because Claude treats the
|
|
33
|
+
diagram as the spec*.
|
|
33
34
|
|
|
34
35
|
If you've ever asked an AI agent "where would I add X?" and watched
|
|
35
36
|
it guess from filenames, archik is the fix: the YAML answers the
|
|
@@ -38,13 +39,25 @@ work.
|
|
|
38
39
|
|
|
39
40
|
## Quickstart
|
|
40
41
|
|
|
42
|
+
Two terminal commands, then talk to Claude:
|
|
43
|
+
|
|
41
44
|
```bash
|
|
42
|
-
npx archik init #
|
|
43
|
-
|
|
44
|
-
npx archik
|
|
45
|
+
npx archik@latest init # scaffolds .archik/main.archik.yaml +
|
|
46
|
+
# installs the Claude skill + /archik:* slash commands
|
|
47
|
+
npx archik@latest start # opens the live canvas at http://localhost:5173
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
Then in Claude Code, type:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
/archik:spawn # mirror your real source tree as the first diagram
|
|
54
|
+
/archik:evolve # propose a cleaner bounded-context refactor
|
|
55
|
+
/archik:suggest <feature> # propose changes for a specific feature
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Each `/archik:*` command stages a suggestion sidecar — **Review** in the canvas, then **Accept** or **Reject**. No manual YAML editing on either side: you click in the browser, Claude drives through the CLI.
|
|
59
|
+
|
|
60
|
+
Done with the canvas? `npx archik stop`.
|
|
48
61
|
|
|
49
62
|
<p align="center">
|
|
50
63
|
<video src="https://github.com/bacharSalleh/archik/raw/main/docs/record.mp4" poster="https://cdn.jsdelivr.net/gh/bacharSalleh/archik@main/docs/archik.gif" width="780" controls muted autoplay loop playsinline>
|
|
@@ -90,28 +103,49 @@ No `x` / `y` / `width` — layout is computed by [ELK](https://eclipse.dev/elk/)
|
|
|
90
103
|
- **12 relationships** with distinct visual styling — `http_call`, `invokes`, `reads`, `writes`, `publishes`, `subscribes`, `streams_to`, `routes_to`, `implements`, `depends_on`, `has_a`, `uses`.
|
|
91
104
|
- **Drag-to-connect, multi-select, undo/redo, compact view, themed (dark / light), notes per node, color overrides on edges.**
|
|
92
105
|
- **CI-ready CLI** — `validate`, `render` (headless SVG), `watch`, `check` (drift between YAML and source dirs).
|
|
93
|
-
- **AI skill + slash commands** — `archik
|
|
106
|
+
- **AI skill + slash commands** — `archik init` installs both automatically. Seven `/archik:*` commands (`spawn`, `evolve`, `suggest`, `describe`, `dev`, `accept`, `reject`) drive the diagram entirely through the CLI, so Claude never edits YAML by hand.
|
|
94
107
|
|
|
95
108
|
## For Claude Code & other LLMs
|
|
96
109
|
|
|
97
|
-
The whole reason
|
|
110
|
+
The whole reason archik uses YAML instead of a binary format: **the file is the shared map between you and the model**. `npx archik@latest init` drops both the Claude skill and the seven slash commands into your project — no separate setup.
|
|
98
111
|
|
|
99
|
-
|
|
100
|
-
archik skill --user # install the skill into ~/.claude/skills
|
|
101
|
-
archik commands --user # install the /archik:* slash commands into ~/.claude/commands
|
|
102
|
-
```
|
|
112
|
+
The skill enforces a hard rule: **Claude talks to 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`. You own the file; the CLI is the contract.
|
|
103
113
|
|
|
104
|
-
|
|
114
|
+
### The seven slash commands
|
|
105
115
|
|
|
106
|
-
|
|
116
|
+
| Command | What it does |
|
|
117
|
+
| --------------------------- | ----------------------------------------------------------- |
|
|
118
|
+
| `/archik:spawn` | Bootstrap a diagram by mirroring your real source tree |
|
|
119
|
+
| `/archik:evolve` | Propose a cleaner bounded-context refactor |
|
|
120
|
+
| `/archik:suggest <feature>` | Propose changes for a specific feature |
|
|
121
|
+
| `/archik:describe <id>` | Explain a node and its connections |
|
|
122
|
+
| `/archik:dev` | Open the live canvas |
|
|
123
|
+
| `/archik:accept` | Apply the pending suggestion |
|
|
124
|
+
| `/archik:reject` | Discard the pending suggestion |
|
|
107
125
|
|
|
108
|
-
|
|
126
|
+
A typical first-day flow:
|
|
109
127
|
|
|
110
128
|
```
|
|
111
|
-
/archik:
|
|
129
|
+
/archik:spawn # mirror what's there now
|
|
130
|
+
# → review on the canvas, accept
|
|
131
|
+
/archik:evolve # propose a cleaner shape
|
|
132
|
+
# → discuss with Claude, accept (or iterate)
|
|
133
|
+
/archik:suggest add Stripe webhook handler
|
|
134
|
+
# → small, targeted change
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Each command stages a sidecar via `npx archik suggest set`. The canvas shows a green/red/amber diff overlay; you click Accept or Reject — or `/archik:accept` / `/archik:reject` from the terminal. Same outcome either way.
|
|
138
|
+
|
|
139
|
+
### Manual install (existing projects without `archik init`)
|
|
140
|
+
|
|
141
|
+
If you already have an archik file and just want to add the Claude integration:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npx archik@latest skill --user # install skill into ~/.claude/skills (all projects)
|
|
145
|
+
npx archik@latest commands --user # install /archik:* into ~/.claude/commands (all projects)
|
|
112
146
|
```
|
|
113
147
|
|
|
114
|
-
|
|
148
|
+
Drop the `--user` flag to scope to the current project only.
|
|
115
149
|
|
|
116
150
|
## Commands
|
|
117
151
|
|