archik 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -11
- package/commands/self-evolving.md +67 -0
- package/dist/cli/archik.mjs +656 -355
- package/dist/ui/assets/index-BkcoNVrI.js +226 -0
- package/dist/ui/assets/index-CQxn9Zg8.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +2 -1
- package/patterns/evolution-loop.blueprint.yaml +69 -0
- package/patterns/evolution-loop.md +64 -0
- package/patterns/feedback-pipeline.md +52 -0
- package/patterns/learned-overlay.md +52 -0
- package/patterns/sidecar-approval-gate.md +52 -0
- package/patterns/truth-chain.md +54 -0
- package/skills/archik/SKILL.md +32 -2
- package/dist/ui/assets/index-D08Zt2_n.js +0 -226
- package/dist/ui/assets/index-DVBaG20X.css +0 -1
package/README.md
CHANGED
|
@@ -41,9 +41,11 @@ Actor → Use case → Slice → Tests on disk → Seq diagram → Nodes → Sou
|
|
|
41
41
|
- 🤖 **AI-native** — installable Claude Code skill + 12 slash commands, and an MCP server for Cursor, Windsurf, Copilot, Claude Desktop, Zed
|
|
42
42
|
- ✅ **Validator, not convention** — schema, cross-file references, `sourcePath` existence, use-case/actor/seq integrity, ECB rules
|
|
43
43
|
- 🔍 **Traceability** — `archik trace` proves which use case slices are tested and realized; `--fail-on` gates CI
|
|
44
|
-
- 🌿 **Git-aware** — `archik diff origin/main` shows what a branch changes architecturally; `archik affected` maps changed files to nodes, slices, and tests
|
|
45
|
-
- 🤝 **Team-ready** — semantic merge driver for YAML, node ownership, and governance constraints (architecture fitness rules)
|
|
46
|
-
-
|
|
44
|
+
- 🌿 **Git-aware** — `archik diff origin/main` shows what a branch changes architecturally; `archik affected` maps changed files to nodes, slices, and tests (`--run` executes them); `archik hooks install` gates every commit
|
|
45
|
+
- 🤝 **Team-ready** — semantic merge driver for YAML, node ownership with CODEOWNERS sync, and governance constraints (architecture fitness rules)
|
|
46
|
+
- 🔬 **Verified at every altitude** — `validate` proves the model is consistent, `drift --edges` proves it matches the code's import graph, `otel check` proves it matches production traffic
|
|
47
|
+
- 🧬 **Self-evolving** — opt-in `archik evolution` loop (observe → reflect → propose → validate → apply → measure) learns from your accepts, rejects, and failures and proposes its own upgrades behind a human approval gate; `archik patterns` ships the same design patterns for your systems
|
|
48
|
+
- 🚀 **Fast adoption** — `archik import compose` / `import mermaid` bootstrap a diagram from what you already have; `/archik:spawn` mirrors an existing source tree
|
|
47
49
|
- 📦 **Zero runtime dependencies** in the published package
|
|
48
50
|
|
|
49
51
|
## Installation
|
|
@@ -86,13 +88,14 @@ Day-to-day:
|
|
|
86
88
|
| `/archik:usecase <name>` | A use case with flows, slices, and test paths |
|
|
87
89
|
| `/archik:trace` | "Are we done?" — the coverage matrix |
|
|
88
90
|
|
|
89
|
-
**Already
|
|
91
|
+
**Already have docker-compose or Mermaid diagrams?** Skip the blank canvas:
|
|
90
92
|
|
|
91
93
|
```bash
|
|
92
94
|
npx archik import compose --out .archik/main.archik.yaml
|
|
95
|
+
npx archik import mermaid docs/architecture.mmd --out .archik/main.archik.yaml
|
|
93
96
|
```
|
|
94
97
|
|
|
95
|
-
Compose services become nodes (postgres → `database`, redis → `cache`, kafka → `stream`, …), build contexts become `sourcePath`s, and `depends_on` becomes edges.
|
|
98
|
+
Compose services become nodes (postgres → `database`, redis → `cache`, kafka → `stream`, …), build contexts become `sourcePath`s, and `depends_on` becomes edges. The Mermaid importer parses the flowchart subset: shaped nodes map to kinds, subgraphs become module parents, arrows become labelled edges.
|
|
96
99
|
|
|
97
100
|
## The YAML
|
|
98
101
|
|
|
@@ -135,23 +138,35 @@ Full schema: `npx archik schema` (also `schema seq | uc | actors`).
|
|
|
135
138
|
# What am I touching on this branch? Which tests cover it?
|
|
136
139
|
npx archik affected --since main
|
|
137
140
|
|
|
141
|
+
# …and run exactly those tests (vitest/jest/playwright/mocha auto-detected)
|
|
142
|
+
npx archik affected --since main --run
|
|
143
|
+
|
|
138
144
|
# What does this branch change architecturally?
|
|
139
145
|
npx archik diff origin/main # add --out diff.svg for the visual
|
|
140
146
|
|
|
141
147
|
# Is the diagram still telling the truth?
|
|
142
148
|
npx archik validate && npx archik drift
|
|
143
149
|
|
|
150
|
+
# Do the EDGES match the code? (TS/JS import-graph verification)
|
|
151
|
+
npx archik drift --edges # shadow + phantom edge detection
|
|
152
|
+
|
|
144
153
|
# Are we done?
|
|
145
154
|
npx archik trace
|
|
146
155
|
```
|
|
147
156
|
|
|
148
157
|
`affected` walks the chain backwards: changed files → nodes (via `sourcePath`) → use case slices (via tests and sequence-diagram participants) → tests to run — and flags changed files no node or test claims.
|
|
149
158
|
|
|
159
|
+
`drift --edges` scans the imports under every node's `sourcePath` and reports **shadow edges** (code imports across nodes with no declared edge) and **phantom edges** (structural edges with no import in either direction). Gate every commit locally with:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npx archik hooks install # pre-commit: archik validate
|
|
163
|
+
```
|
|
164
|
+
|
|
150
165
|
## AI integration
|
|
151
166
|
|
|
152
167
|
**Claude Code** (deepest integration): `archik init` installs a skill that enforces one hard 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.
|
|
153
168
|
|
|
154
|
-
**Everything else** (MCP): `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — 20 tools covering schema, queries, trace, validate, drift, affected, and the suggestion lifecycle:
|
|
169
|
+
**Everything else** (MCP): `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — 20 tools covering schema, queries, trace, validate, drift, affected, and the suggestion lifecycle, plus **resources** (`archik://schema`, `archik://stats`, `archik://trace`, `archik://validate`, `archik://drift`) and **prompts** (`propose-change`, `review-architecture`) that encode the same working loop the Claude Code skill teaches:
|
|
155
170
|
|
|
156
171
|
```jsonc
|
|
157
172
|
// .cursor/mcp.json, claude_desktop_config.json, etc.
|
|
@@ -172,7 +187,7 @@ npx archik merge-driver --install # once per clone; .gitattributes line is co
|
|
|
172
187
|
|
|
173
188
|
Both branches added nodes → keep both. One side changed a field → take it. Same field changed differently, or modify-vs-delete → a real conflict, reported precisely.
|
|
174
189
|
|
|
175
|
-
**Ownership.** `owner: team-billing` on a node answers "who do I talk to": `archik q describe payments-db`, `archik q list --owner team-billing`.
|
|
190
|
+
**Ownership.** `owner: team-billing` on a node answers "who do I talk to": `archik q describe payments-db`, `archik q list --owner team-billing`. And `archik owners sync` writes one CODEOWNERS rule per owned node into a managed block (hand-authored rules untouched), with `archik owners check` as the CI gate so review routing can't drift from the model.
|
|
176
191
|
|
|
177
192
|
**Governance constraints.** Architecture fitness rules, enforced by `archik validate` on every run:
|
|
178
193
|
|
|
@@ -191,6 +206,42 @@ constraints:
|
|
|
191
206
|
|
|
192
207
|
Intentional exceptions are grandfathered by id in an `except` list — visible in review, never silent.
|
|
193
208
|
|
|
209
|
+
## Verified against production
|
|
210
|
+
|
|
211
|
+
Map nodes to your tracing backend's service names (`metadata.otelService`, node id as the fallback), export the service-dependency graph, and let archik compare:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
curl -s "http://jaeger:16686/api/dependencies?endTs=$(date +%s)000&lookback=86400000" > deps.json
|
|
215
|
+
npx archik otel check --graph deps.json
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Undeclared production calls — traffic the diagram doesn't admit to — fail the check; declared wire edges that saw no traffic are reported informationally. That completes the truth chain: `validate` proves the model is consistent, `drift --edges` proves it matches the code, `otel check` proves it matches production.
|
|
219
|
+
|
|
220
|
+
## Self-evolution
|
|
221
|
+
|
|
222
|
+
Archik can learn from how you use it. Everything is opt-in, local-only, and human-gated:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
archik evolution enable # start observing (events stay on your machine)
|
|
226
|
+
# ... normal work: suggestions accepted/rejected, validate/drift runs ...
|
|
227
|
+
archik evolution reflect # recurring friction → pending proposals with evidence
|
|
228
|
+
archik evolution proposals # read them
|
|
229
|
+
archik evolution approve <id># apply: a learned.md note, or a sidecar diff you still review
|
|
230
|
+
archik evolution report # did it help? last 7 days vs the 7 before
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Approved lessons land in `.archik/evolution/learned.md` — the Claude skill reads it at session start (and MCP agents via `archik://learned`), so the AI gets smarter across sessions without anyone editing prompts. Rejecting a proposal is recorded too; the loop learns from "no".
|
|
234
|
+
|
|
235
|
+
Building a self-evolving system of your own? The same patterns ship as a library:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
archik patterns list # evolution-loop, sidecar-approval-gate,
|
|
239
|
+
archik patterns show evolution-loop # learned-overlay, truth-chain, feedback-pipeline
|
|
240
|
+
archik patterns apply evolution-loop # stage the blueprint into YOUR diagram (gated)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Deep dives in [docs/advanced-topics](./docs/advanced-topics/README.md). In Claude Code: `/archik:self-evolving <your idea>`.
|
|
244
|
+
|
|
194
245
|
## CI
|
|
195
246
|
|
|
196
247
|
Plain commands:
|
|
@@ -236,14 +287,19 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
236
287
|
| `archik watch` | Re-render SVG on every change |
|
|
237
288
|
| `archik q <sub>` | Query: `describe` `deps` `dependents` `impact` `list` `edges` `stats` `usecases` `describe-usecase` `actors` `sequences` |
|
|
238
289
|
| `archik diff <a> [b]` | Diff two files **or git refs**; one arg = that ref vs working tree |
|
|
239
|
-
| `archik affected` | Changed files → nodes, slices, tests to run (`--since <ref>`, `--files`) |
|
|
290
|
+
| `archik affected` | Changed files → nodes, slices, tests to run (`--since <ref>`, `--files`, `--run` to execute them) |
|
|
240
291
|
| `archik trace` | Coverage matrix (`--fail-on partial\|none` for CI) |
|
|
241
|
-
| `archik drift` | sourcePath / test-path gaps vs the source tree |
|
|
292
|
+
| `archik drift` | sourcePath / test-path gaps vs the source tree (`--edges` verifies edges vs the TS/JS import graph) |
|
|
293
|
+
| `archik otel check --graph <f>` | Verify edges against a production service-dependency graph |
|
|
242
294
|
| `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` |
|
|
243
295
|
| `archik alpha <sub>` | Essence alphas: `show`, `promote` (machine-checked), `demote` |
|
|
244
|
-
| `archik
|
|
296
|
+
| `archik evolution <sub>` | Self-evolution loop: `enable` `status` `reflect` `proposals` `propose` `approve` `reject` `report` |
|
|
297
|
+
| `archik patterns <sub>` | Self-evolution pattern library: `list` `show <id>` `apply <id>` |
|
|
298
|
+
| `archik import compose\|mermaid [file]` | Bootstrap a document from docker-compose or a Mermaid flowchart |
|
|
245
299
|
| `archik merge-driver --install` | Semantic git merge for `*.archik.yaml` |
|
|
246
|
-
| `archik
|
|
300
|
+
| `archik hooks install` | Pre-commit hook running `archik validate` (`--with-drift` optional) |
|
|
301
|
+
| `archik owners sync\|check` | Keep CODEOWNERS in step with node owners |
|
|
302
|
+
| `archik mcp` | MCP server over stdio (tools + resources + prompts) for non-Claude-Code agents |
|
|
247
303
|
| `archik schema [seq\|uc\|actors]` | Print the document schemas |
|
|
248
304
|
| `archik upgrade` | Upgrade + refresh installed skill/commands |
|
|
249
305
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Design a self-evolving architecture for an idea, using the pattern library
|
|
3
|
+
argument-hint: <the system idea, e.g. "a code-review bot that learns">
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /archik:self-evolving — from vague idea to self-evolving architecture
|
|
7
|
+
|
|
8
|
+
The user wants a system that **improves itself over time**, and they
|
|
9
|
+
gave you the idea in `$ARGUMENTS`. Your job: guide them from that idea
|
|
10
|
+
to a concrete architecture with an evolution loop — designs, use
|
|
11
|
+
cases, and a staged diagram they can accept or reject.
|
|
12
|
+
|
|
13
|
+
If `$ARGUMENTS` is empty, ask for the idea in one sentence first.
|
|
14
|
+
|
|
15
|
+
## CLI-only — do not touch archik files directly
|
|
16
|
+
|
|
17
|
+
All diagram reads go through `npx archik q`, all diagram writes
|
|
18
|
+
through `npx archik suggest set` or `npx archik patterns apply`.
|
|
19
|
+
Never `Read`/`Write`/`Edit` files under `.archik/`.
|
|
20
|
+
|
|
21
|
+
## Steps
|
|
22
|
+
|
|
23
|
+
1. **Load the pattern library** — this is your design vocabulary:
|
|
24
|
+
```
|
|
25
|
+
npx archik patterns list
|
|
26
|
+
npx archik patterns show evolution-loop
|
|
27
|
+
```
|
|
28
|
+
Read the other patterns (`sidecar-approval-gate`, `learned-overlay`,
|
|
29
|
+
`truth-chain`, `feedback-pipeline`) as they become relevant.
|
|
30
|
+
|
|
31
|
+
2. **Interview briefly** (3 questions max, one at a time):
|
|
32
|
+
- Who corrects the system today? (those corrections = the feedback signal)
|
|
33
|
+
- What change should the system be able to make to itself?
|
|
34
|
+
- Who must approve a self-change before it lands?
|
|
35
|
+
No feedback signal = no evolution loop; help them find one first.
|
|
36
|
+
|
|
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.
|
|
40
|
+
|
|
41
|
+
4. **Map the idea onto the loop.** For each stage, name the concrete
|
|
42
|
+
component in THEIR system:
|
|
43
|
+
| Stage | Their component |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| observe | what gets logged, where |
|
|
46
|
+
| reflect | which rules find patterns |
|
|
47
|
+
| propose | where proposals live, who reads them |
|
|
48
|
+
| validate | what check keeps a bad self-change out |
|
|
49
|
+
| apply | the approval gate (use sidecar-approval-gate) |
|
|
50
|
+
| measure | the one metric that proves improvement |
|
|
51
|
+
|
|
52
|
+
5. **Stage the architecture.** Two routes, both gated:
|
|
53
|
+
- Generic start: `npx archik patterns apply evolution-loop`
|
|
54
|
+
(stages the blueprint as `status: proposed` nodes), then refine
|
|
55
|
+
ids/names with a follow-up `suggest set`.
|
|
56
|
+
- Tailored: author the full end-state and stage via
|
|
57
|
+
`npx archik suggest set --note '…' - <<'YAML' … YAML`.
|
|
58
|
+
|
|
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.
|
|
63
|
+
|
|
64
|
+
7. **Hand over.** Show the canvas URL, summarize which patterns you
|
|
65
|
+
used and why, and point at `npx archik evolution enable` if they
|
|
66
|
+
want archik's own loop watching this project too. **Wait for the
|
|
67
|
+
user to accept/reject — never accept the sidecar yourself.**
|