@devenius/junamis-skills 0.0.0-stage → 1.1.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/CHANGELOG.md +150 -0
- package/LICENSE +21 -0
- package/README.md +231 -2
- package/SECURITY.md +81 -0
- package/bin/junamis-skills.js +7 -0
- package/dist/cli.d.ts +59 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +564 -0
- package/dist/cli.js.map +1 -0
- package/dist/color.d.ts +40 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +55 -0
- package/dist/color.js.map +1 -0
- package/dist/design/atomic.d.ts +4 -0
- package/dist/design/atomic.d.ts.map +1 -0
- package/dist/design/atomic.js +14 -0
- package/dist/design/atomic.js.map +1 -0
- package/dist/design/bootstrap.d.ts +23 -0
- package/dist/design/bootstrap.d.ts.map +1 -0
- package/dist/design/bootstrap.js +411 -0
- package/dist/design/bootstrap.js.map +1 -0
- package/dist/design/cli.d.ts +86 -0
- package/dist/design/cli.d.ts.map +1 -0
- package/dist/design/cli.js +425 -0
- package/dist/design/cli.js.map +1 -0
- package/dist/design/delta.d.ts +45 -0
- package/dist/design/delta.d.ts.map +1 -0
- package/dist/design/delta.js +557 -0
- package/dist/design/delta.js.map +1 -0
- package/dist/design/drift.d.ts +26 -0
- package/dist/design/drift.d.ts.map +1 -0
- package/dist/design/drift.js +341 -0
- package/dist/design/drift.js.map +1 -0
- package/dist/design/errors.d.ts +25 -0
- package/dist/design/errors.d.ts.map +1 -0
- package/dist/design/errors.js +30 -0
- package/dist/design/errors.js.map +1 -0
- package/dist/design/events.d.ts +18 -0
- package/dist/design/events.d.ts.map +1 -0
- package/dist/design/events.js +44 -0
- package/dist/design/events.js.map +1 -0
- package/dist/design/fingerprint.d.ts +10 -0
- package/dist/design/fingerprint.d.ts.map +1 -0
- package/dist/design/fingerprint.js +66 -0
- package/dist/design/fingerprint.js.map +1 -0
- package/dist/design/index-gen.d.ts +16 -0
- package/dist/design/index-gen.d.ts.map +1 -0
- package/dist/design/index-gen.js +94 -0
- package/dist/design/index-gen.js.map +1 -0
- package/dist/design/schema.d.ts +54 -0
- package/dist/design/schema.d.ts.map +1 -0
- package/dist/design/schema.js +408 -0
- package/dist/design/schema.js.map +1 -0
- package/dist/design/yaml.d.ts +12 -0
- package/dist/design/yaml.d.ts.map +1 -0
- package/dist/design/yaml.js +264 -0
- package/dist/design/yaml.js.map +1 -0
- package/dist/external.d.ts +61 -0
- package/dist/external.d.ts.map +1 -0
- package/dist/external.js +426 -0
- package/dist/external.js.map +1 -0
- package/dist/guide.d.ts +17 -0
- package/dist/guide.d.ts.map +1 -0
- package/dist/guide.js +219 -0
- package/dist/guide.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/install-external.d.ts +3 -0
- package/dist/install-external.d.ts.map +1 -0
- package/dist/install-external.js +37 -0
- package/dist/install-external.js.map +1 -0
- package/dist/library-install.d.ts +39 -0
- package/dist/library-install.d.ts.map +1 -0
- package/dist/library-install.js +663 -0
- package/dist/library-install.js.map +1 -0
- package/dist/orchestrator/boot.d.ts +3 -0
- package/dist/orchestrator/boot.d.ts.map +1 -0
- package/dist/orchestrator/boot.js +515 -0
- package/dist/orchestrator/boot.js.map +1 -0
- package/dist/orchestrator/cli.d.ts +37 -0
- package/dist/orchestrator/cli.d.ts.map +1 -0
- package/dist/orchestrator/cli.js +563 -0
- package/dist/orchestrator/cli.js.map +1 -0
- package/dist/orchestrator/commands.d.ts +46 -0
- package/dist/orchestrator/commands.d.ts.map +1 -0
- package/dist/orchestrator/commands.js +752 -0
- package/dist/orchestrator/commands.js.map +1 -0
- package/dist/orchestrator/compaction.d.ts +21 -0
- package/dist/orchestrator/compaction.d.ts.map +1 -0
- package/dist/orchestrator/compaction.js +93 -0
- package/dist/orchestrator/compaction.js.map +1 -0
- package/dist/orchestrator/drift.d.ts +11 -0
- package/dist/orchestrator/drift.d.ts.map +1 -0
- package/dist/orchestrator/drift.js +181 -0
- package/dist/orchestrator/drift.js.map +1 -0
- package/dist/orchestrator/errors.d.ts +52 -0
- package/dist/orchestrator/errors.d.ts.map +1 -0
- package/dist/orchestrator/errors.js +96 -0
- package/dist/orchestrator/errors.js.map +1 -0
- package/dist/orchestrator/frontmatter.d.ts +6 -0
- package/dist/orchestrator/frontmatter.d.ts.map +1 -0
- package/dist/orchestrator/frontmatter.js +50 -0
- package/dist/orchestrator/frontmatter.js.map +1 -0
- package/dist/orchestrator/fsx.d.ts +45 -0
- package/dist/orchestrator/fsx.d.ts.map +1 -0
- package/dist/orchestrator/fsx.js +295 -0
- package/dist/orchestrator/fsx.js.map +1 -0
- package/dist/orchestrator/handoff.d.ts +8 -0
- package/dist/orchestrator/handoff.d.ts.map +1 -0
- package/dist/orchestrator/handoff.js +246 -0
- package/dist/orchestrator/handoff.js.map +1 -0
- package/dist/orchestrator/hash.d.ts +10 -0
- package/dist/orchestrator/hash.d.ts.map +1 -0
- package/dist/orchestrator/hash.js +65 -0
- package/dist/orchestrator/hash.js.map +1 -0
- package/dist/orchestrator/journal.d.ts +35 -0
- package/dist/orchestrator/journal.d.ts.map +1 -0
- package/dist/orchestrator/journal.js +163 -0
- package/dist/orchestrator/journal.js.map +1 -0
- package/dist/orchestrator/lease.d.ts +31 -0
- package/dist/orchestrator/lease.d.ts.map +1 -0
- package/dist/orchestrator/lease.js +175 -0
- package/dist/orchestrator/lease.js.map +1 -0
- package/dist/orchestrator/plan.d.ts +27 -0
- package/dist/orchestrator/plan.d.ts.map +1 -0
- package/dist/orchestrator/plan.js +240 -0
- package/dist/orchestrator/plan.js.map +1 -0
- package/dist/orchestrator/report.d.ts +49 -0
- package/dist/orchestrator/report.d.ts.map +1 -0
- package/dist/orchestrator/report.js +244 -0
- package/dist/orchestrator/report.js.map +1 -0
- package/dist/orchestrator/state.d.ts +43 -0
- package/dist/orchestrator/state.d.ts.map +1 -0
- package/dist/orchestrator/state.js +369 -0
- package/dist/orchestrator/state.js.map +1 -0
- package/dist/orchestrator/store.d.ts +42 -0
- package/dist/orchestrator/store.d.ts.map +1 -0
- package/dist/orchestrator/store.js +202 -0
- package/dist/orchestrator/store.js.map +1 -0
- package/dist/orchestrator/test-hooks.d.ts +5 -0
- package/dist/orchestrator/test-hooks.d.ts.map +1 -0
- package/dist/orchestrator/test-hooks.js +31 -0
- package/dist/orchestrator/test-hooks.js.map +1 -0
- package/dist/orchestrator/time.d.ts +11 -0
- package/dist/orchestrator/time.d.ts.map +1 -0
- package/dist/orchestrator/time.js +38 -0
- package/dist/orchestrator/time.js.map +1 -0
- package/dist/paths.d.ts +9 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +42 -0
- package/dist/paths.js.map +1 -0
- package/dist/pinned-source.d.ts +13 -0
- package/dist/pinned-source.d.ts.map +1 -0
- package/dist/pinned-source.js +238 -0
- package/dist/pinned-source.js.map +1 -0
- package/dist/reconcile/cli.d.ts +17 -0
- package/dist/reconcile/cli.d.ts.map +1 -0
- package/dist/reconcile/cli.js +171 -0
- package/dist/reconcile/cli.js.map +1 -0
- package/dist/reconcile/detectors.d.ts +29 -0
- package/dist/reconcile/detectors.d.ts.map +1 -0
- package/dist/reconcile/detectors.js +294 -0
- package/dist/reconcile/detectors.js.map +1 -0
- package/dist/reconcile/manifest.d.ts +11 -0
- package/dist/reconcile/manifest.d.ts.map +1 -0
- package/dist/reconcile/manifest.js +118 -0
- package/dist/reconcile/manifest.js.map +1 -0
- package/dist/reconcile/queue.d.ts +3 -0
- package/dist/reconcile/queue.d.ts.map +1 -0
- package/dist/reconcile/queue.js +723 -0
- package/dist/reconcile/queue.js.map +1 -0
- package/dist/reconcile/score.d.ts +19 -0
- package/dist/reconcile/score.d.ts.map +1 -0
- package/dist/reconcile/score.js +58 -0
- package/dist/reconcile/score.js.map +1 -0
- package/dist/scripts/check-opencode-config.d.ts +12 -0
- package/dist/scripts/check-opencode-config.d.ts.map +1 -0
- package/dist/scripts/check-opencode-config.js +216 -0
- package/dist/scripts/check-opencode-config.js.map +1 -0
- package/dist/scripts/check-pack.d.ts +3 -0
- package/dist/scripts/check-pack.d.ts.map +1 -0
- package/dist/scripts/check-pack.js +74 -0
- package/dist/scripts/check-pack.js.map +1 -0
- package/dist/scripts/check-pins.d.ts +9 -0
- package/dist/scripts/check-pins.d.ts.map +1 -0
- package/dist/scripts/check-pins.js +65 -0
- package/dist/scripts/check-pins.js.map +1 -0
- package/dist/scripts/check-security.d.ts +3 -0
- package/dist/scripts/check-security.d.ts.map +1 -0
- package/dist/scripts/check-security.js +47 -0
- package/dist/scripts/check-security.js.map +1 -0
- package/dist/scripts/check-skills-lock.d.ts +7 -0
- package/dist/scripts/check-skills-lock.d.ts.map +1 -0
- package/dist/scripts/check-skills-lock.js +36 -0
- package/dist/scripts/check-skills-lock.js.map +1 -0
- package/dist/scripts/check-skills-sync.d.ts +7 -0
- package/dist/scripts/check-skills-sync.d.ts.map +1 -0
- package/dist/scripts/check-skills-sync.js +146 -0
- package/dist/scripts/check-skills-sync.js.map +1 -0
- package/dist/scripts/check-yaml.d.ts +3 -0
- package/dist/scripts/check-yaml.d.ts.map +1 -0
- package/dist/scripts/check-yaml.js +41 -0
- package/dist/scripts/check-yaml.js.map +1 -0
- package/dist/scripts/publish-npm.d.ts +3 -0
- package/dist/scripts/publish-npm.d.ts.map +1 -0
- package/dist/scripts/publish-npm.js +67 -0
- package/dist/scripts/publish-npm.js.map +1 -0
- package/dist/scripts/release-check.d.ts +3 -0
- package/dist/scripts/release-check.d.ts.map +1 -0
- package/dist/scripts/release-check.js +97 -0
- package/dist/scripts/release-check.js.map +1 -0
- package/dist/scripts/support.d.ts +41 -0
- package/dist/scripts/support.d.ts.map +1 -0
- package/dist/scripts/support.js +78 -0
- package/dist/scripts/support.js.map +1 -0
- package/dist/targets/claude.d.ts +4 -0
- package/dist/targets/claude.d.ts.map +1 -0
- package/dist/targets/claude.js +42 -0
- package/dist/targets/claude.js.map +1 -0
- package/dist/targets/cline.d.ts +4 -0
- package/dist/targets/cline.d.ts.map +1 -0
- package/dist/targets/cline.js +39 -0
- package/dist/targets/cline.js.map +1 -0
- package/dist/targets/cursor.d.ts +4 -0
- package/dist/targets/cursor.d.ts.map +1 -0
- package/dist/targets/cursor.js +40 -0
- package/dist/targets/cursor.js.map +1 -0
- package/dist/targets/index.d.ts +4 -0
- package/dist/targets/index.d.ts.map +1 -0
- package/dist/targets/index.js +11 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/opencode.d.ts +4 -0
- package/dist/targets/opencode.d.ts.map +1 -0
- package/dist/targets/opencode.js +48 -0
- package/dist/targets/opencode.js.map +1 -0
- package/dist/targets/windsurf.d.ts +4 -0
- package/dist/targets/windsurf.d.ts.map +1 -0
- package/dist/targets/windsurf.js +41 -0
- package/dist/targets/windsurf.js.map +1 -0
- package/dist/types/common.d.ts +193 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/design.d.ts +185 -0
- package/dist/types/design.d.ts.map +1 -0
- package/dist/types/design.js +3 -0
- package/dist/types/design.js.map +1 -0
- package/dist/types/guards.d.ts +13 -0
- package/dist/types/guards.d.ts.map +1 -0
- package/dist/types/guards.js +64 -0
- package/dist/types/guards.js.map +1 -0
- package/dist/types/handoff.d.ts +29 -0
- package/dist/types/handoff.d.ts.map +1 -0
- package/dist/types/handoff.js +3 -0
- package/dist/types/handoff.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/orchestrator.d.ts +414 -0
- package/dist/types/orchestrator.d.ts.map +1 -0
- package/dist/types/orchestrator.js +4 -0
- package/dist/types/orchestrator.js.map +1 -0
- package/dist/types/reconcile.d.ts +160 -0
- package/dist/types/reconcile.d.ts.map +1 -0
- package/dist/types/reconcile.js +3 -0
- package/dist/types/reconcile.js.map +1 -0
- package/docs/RECONCILE.md +505 -0
- package/docs/design/_schema.md +506 -0
- package/junamis-skills.yml +328 -0
- package/library/EXTERNAL.md +35 -0
- package/library/HANDOFF.md +93 -0
- package/library/RESUME.md +429 -0
- package/library/SAFETY.md +83 -0
- package/library/agents/context-keeper.md +41 -0
- package/library/agents/frontend.md +43 -0
- package/library/agents/maintainer.md +44 -0
- package/library/agents/nestjs.md +40 -0
- package/library/agents/nextjs.md +40 -0
- package/library/agents/operator.md +42 -0
- package/library/agents/orchestrator.md +313 -0
- package/library/agents/researcher.md +40 -0
- package/library/agents/reviewer.md +40 -0
- package/library/skills/db-migrate/SKILL.md +50 -0
- package/library/skills/decision-record/SKILL.md +74 -0
- package/library/skills/dependency-upgrade/SKILL.md +57 -0
- package/library/skills/deploy-verify/SKILL.md +51 -0
- package/library/skills/document/SKILL.md +51 -0
- package/library/skills/env-doctor/SKILL.md +65 -0
- package/library/skills/frontend/SKILL.md +63 -0
- package/library/skills/handoff/SKILL.md +79 -0
- package/library/skills/incident-response/SKILL.md +69 -0
- package/library/skills/nestjs/SKILL.md +49 -0
- package/library/skills/nextjs/SKILL.md +48 -0
- package/library/skills/perf-budget/SKILL.md +62 -0
- package/library/skills/refactor-safely/SKILL.md +48 -0
- package/library/skills/release-prep/SKILL.md +75 -0
- package/library/skills/research/SKILL.md +66 -0
- package/library/skills/rollback/SKILL.md +49 -0
- package/library/skills/route/SKILL.md +107 -0
- package/library/skills/route-external/SKILL.md +67 -0
- package/library/skills/security-audit/SKILL.md +64 -0
- package/library/skills/skill-author/SKILL.md +49 -0
- package/opencode.json +5906 -0
- package/package.json +88 -4
- package/scripts/design-registry.mjs +7 -0
- package/scripts/orchestrator-state.mjs +7 -0
- package/scripts/reconcile.mjs +7 -0
- package/skills-lock.json +197 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
# DESIGN.md — Design Registry Contract
|
|
2
|
+
|
|
3
|
+
**Status:** normative
|
|
4
|
+
**Schema version:** 1
|
|
5
|
+
**Companion contracts:** `HANDOFF.md` (step output), `RESUME.md` (run persistence), `skills-lock.json`, `library/*`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Purpose
|
|
10
|
+
|
|
11
|
+
Define a durable, structured, machine-readable registry of **design surfaces** in the project so that:
|
|
12
|
+
|
|
13
|
+
1. The orchestrator can **load the intended state of any surface into context before routing** a capability that touches it.
|
|
14
|
+
2. Every skill that modifies a surface emits a **design delta** that the orchestrator folds into the registry — designs do not rot.
|
|
15
|
+
3. **Drift between code and design is detected and escalated**, never silently ignored.
|
|
16
|
+
4. A fresh reader (agent or human) can open `docs/design/<kind>/<surface>.md` and answer, unambiguously:
|
|
17
|
+
- *What is actually sitting here right now?*
|
|
18
|
+
- *What needs to be adjusted?*
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 2. Core principle
|
|
23
|
+
|
|
24
|
+
> **The design registry is the orchestrator's persistent domain memory. Code is verified against it, not the reverse.**
|
|
25
|
+
|
|
26
|
+
This means:
|
|
27
|
+
- Before work: the orchestrator loads the relevant registry entries into the skill's context.
|
|
28
|
+
- After work: the skill emits a delta; the orchestrator applies it atomically.
|
|
29
|
+
- If code changes without a matching delta: **drift**, escalated to `needs_review`.
|
|
30
|
+
|
|
31
|
+
The registry is not documentation for humans (though humans benefit). It is the **contract the orchestrator reasons over**.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3. Invariants (MUST rules)
|
|
36
|
+
|
|
37
|
+
1. **D1 — Single registry root.** All design docs live under `DESIGN_ROOT` (default `docs/design/`).
|
|
38
|
+
2. **D2 — One file per surface.** Each file describes exactly one surface (page, endpoint, entity, module, infra unit). No multi-surface files.
|
|
39
|
+
3. **D3 — Frontmatter is authoritative metadata.** `surface_id`, `kind`, `status`, `code_paths`, `design_checksum` are read by the orchestrator; the body is read into context.
|
|
40
|
+
4. **D4 — Delta, not rewrite.** Skills MUST NOT rewrite a design file wholesale. They emit a `design_delta` (§7) that the orchestrator applies mechanically.
|
|
41
|
+
5. **D5 — Checksum discipline.** Every applied delta updates `design_checksum`. The checksum is computed over the canonicalized body (frontmatter excluded).
|
|
42
|
+
6. **D6 — Coverage is enforced.** Every code path matched by a registered surface's `code_paths` MUST have exactly one owning surface. Unclaimed code paths are a `coverage_gap`.
|
|
43
|
+
7. **D7 — Drift is a correctness event.** Code changed under a surface whose `design_checksum` did not update → `needs_review`. Never a warning.
|
|
44
|
+
8. **D8 — INDEX is derived.** `INDEX.md` is regenerated from frontmatter; it is never edited by hand and never read as input to logic.
|
|
45
|
+
9. **D9 — Append-only history.** The `## Change log` section is append-only. Older entries are never rewritten.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 4. Directory layout
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
docs/design/
|
|
53
|
+
├── _schema.md # this document
|
|
54
|
+
├── INDEX.md # generated
|
|
55
|
+
├── web/
|
|
56
|
+
│ ├── homepage.md
|
|
57
|
+
│ ├── dashboard.md
|
|
58
|
+
│ └── settings/profile.md
|
|
59
|
+
├── api/
|
|
60
|
+
│ ├── get-user.md
|
|
61
|
+
│ ├── post-user.md
|
|
62
|
+
│ └── auth/login.md
|
|
63
|
+
├── data/
|
|
64
|
+
│ ├── user-model.md
|
|
65
|
+
│ └── audit-log-model.md
|
|
66
|
+
├── infra/
|
|
67
|
+
│ └── deployment.md
|
|
68
|
+
└── cli/
|
|
69
|
+
└── init-command.md
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Path convention:** `docs/design/<kind>/<surface-path>.md`, where `<surface-path>` mirrors the domain surface, not necessarily the filesystem. `web/homepage` and `api/get-user` are the canonical examples. `surface_id` equals the path minus `docs/design/` and `.md` (e.g. `web/homepage`).
|
|
73
|
+
|
|
74
|
+
**Monorepo:** add an optional `app` frontmatter field (`web`, `api`, `admin`, etc.) to disambiguate which workspace owns the surface. `surface_id` remains globally unique across the registry.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 5. File anatomy
|
|
79
|
+
|
|
80
|
+
### 5.1 Frontmatter (YAML, required)
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
---
|
|
84
|
+
surface_id: web/homepage
|
|
85
|
+
app: web # optional, monorepo workspace
|
|
86
|
+
kind: web # web | api | data | infra | cli | other
|
|
87
|
+
status: active # draft | active | deprecated | needs_review
|
|
88
|
+
version: 1.3.0 # design version, bumped on any delta
|
|
89
|
+
owner: library/develop # skill or agent responsible
|
|
90
|
+
code_paths: # globs relative to repo root
|
|
91
|
+
- apps/web/src/pages/homepage/**
|
|
92
|
+
- apps/web/src/components/Hero/**
|
|
93
|
+
depends_on: # other surface_ids
|
|
94
|
+
- api/get-user
|
|
95
|
+
related_tasks: # task_ids from plan.json that touched this
|
|
96
|
+
- T-003
|
|
97
|
+
last_reviewed: 2026-11-09
|
|
98
|
+
design_checksum: sha256:9a8b...
|
|
99
|
+
---
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`design_checksum` is `sha256` over the canonicalized body (sections in fixed order, trailing whitespace stripped, line endings normalized to `\n`).
|
|
103
|
+
|
|
104
|
+
### 5.2 Body — required sections (all kinds)
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
## Intent
|
|
108
|
+
|
|
109
|
+
Why this surface exists. The problem it solves. One paragraph.
|
|
110
|
+
|
|
111
|
+
## Current state
|
|
112
|
+
|
|
113
|
+
What is actually sitting here right now. Present tense. This is the section a
|
|
114
|
+
fresh reader opens first to understand the surface. No aspirational language.
|
|
115
|
+
|
|
116
|
+
## Known gaps
|
|
117
|
+
|
|
118
|
+
Bulleted list of what needs to be adjusted, changed, or is missing.
|
|
119
|
+
Each bullet is actionable. Empty list is valid (`- None`) but MUST be explicit.
|
|
120
|
+
|
|
121
|
+
## Change log
|
|
122
|
+
|
|
123
|
+
Append-only. One line per delta applied, newest last.
|
|
124
|
+
|
|
125
|
+
- 2026-11-09 · v1.3.0 · Added pagination params to response · task T-014 · library/develop
|
|
126
|
+
- 2026-11-07 · v1.2.0 · Hero CTA implemented · task T-009 · library/develop
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 5.3 Body — kind-specific sections
|
|
130
|
+
|
|
131
|
+
#### `kind: web`
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
## Structure
|
|
135
|
+
|
|
136
|
+
Component tree and layout. Nesting matters.
|
|
137
|
+
|
|
138
|
+
- HomePage
|
|
139
|
+
- Hero
|
|
140
|
+
- HeroHeadline
|
|
141
|
+
- HeroCTA
|
|
142
|
+
- FeatureGrid
|
|
143
|
+
- FeatureCard ×3
|
|
144
|
+
- Footer
|
|
145
|
+
|
|
146
|
+
## Routes
|
|
147
|
+
|
|
148
|
+
| path | component | auth | notes |
|
|
149
|
+
|------|-----------|------|-------|
|
|
150
|
+
| `/` | HomePage | public | default landing |
|
|
151
|
+
|
|
152
|
+
## State & data
|
|
153
|
+
|
|
154
|
+
| name | source | shape | notes |
|
|
155
|
+
|------|--------|-------|-------|
|
|
156
|
+
| `user` | api/get-user | `{id, name, email}` | loaded on mount |
|
|
157
|
+
|
|
158
|
+
## Props & events
|
|
159
|
+
|
|
160
|
+
| component | props | events |
|
|
161
|
+
|-----------|-------|--------|
|
|
162
|
+
| Hero | `{headline, cta}` | `onCtaClick` |
|
|
163
|
+
|
|
164
|
+
## Accessibility
|
|
165
|
+
|
|
166
|
+
Known a11y requirements, tested or pending.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `kind: api`
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
## Endpoint
|
|
173
|
+
|
|
174
|
+
- Method: `GET`
|
|
175
|
+
- Path: `/api/users/:id`
|
|
176
|
+
- Auth: `bearer`
|
|
177
|
+
- Rate limit: `100/min`
|
|
178
|
+
|
|
179
|
+
## Request
|
|
180
|
+
|
|
181
|
+
| field | in | type | required | notes |
|
|
182
|
+
|-------|----|------|----------|-------|
|
|
183
|
+
| `id` | path | `string(uuid)` | yes | user id |
|
|
184
|
+
|
|
185
|
+
## Response — 200
|
|
186
|
+
|
|
187
|
+
| field | type | nullable | notes |
|
|
188
|
+
|-------|------|----------|-------|
|
|
189
|
+
| `id` | `string(uuid)` | no | |
|
|
190
|
+
| `email` | `string(email)` | no | |
|
|
191
|
+
| `createdAt` | `string(iso8601)` | no | |
|
|
192
|
+
|
|
193
|
+
## Errors
|
|
194
|
+
|
|
195
|
+
| status | code | meaning |
|
|
196
|
+
|--------|------|---------|
|
|
197
|
+
| 404 | `user_not_found` | id valid but unknown |
|
|
198
|
+
| 401 | `unauthorized` | missing/invalid token |
|
|
199
|
+
|
|
200
|
+
## Examples
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{ "id": "…", "email": "a@b.c", "createdAt": "2026-11-09T10:00:00Z" }
|
|
204
|
+
```
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### `kind: data`
|
|
208
|
+
|
|
209
|
+
```markdown
|
|
210
|
+
## Entities
|
|
211
|
+
|
|
212
|
+
### User
|
|
213
|
+
|
|
214
|
+
| field | type | constraints | notes |
|
|
215
|
+
|-------|------|-------------|-------|
|
|
216
|
+
| `id` | uuid | primary key | |
|
|
217
|
+
| `email` | text | unique, not null | |
|
|
218
|
+
|
|
219
|
+
## Indexes
|
|
220
|
+
|
|
221
|
+
| name | columns | type |
|
|
222
|
+
|------|---------|------|
|
|
223
|
+
| `users_email_idx` | `email` | btree unique |
|
|
224
|
+
|
|
225
|
+
## Migrations
|
|
226
|
+
|
|
227
|
+
| id | applied | description |
|
|
228
|
+
|----|---------|-------------|
|
|
229
|
+
| `001_init` | yes | initial users table |
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### `kind: infra`
|
|
233
|
+
|
|
234
|
+
```markdown
|
|
235
|
+
## Topology
|
|
236
|
+
|
|
237
|
+
Named resources and their relations.
|
|
238
|
+
|
|
239
|
+
- `api` (service) → `postgres` (db)
|
|
240
|
+
- `api` (service) → `redis` (cache)
|
|
241
|
+
|
|
242
|
+
## Resources
|
|
243
|
+
|
|
244
|
+
| name | type | spec | notes |
|
|
245
|
+
|------|------|------|-------|
|
|
246
|
+
| `api` | container | 2 vCPU, 1 GB | |
|
|
247
|
+
|
|
248
|
+
## Env & secrets
|
|
249
|
+
|
|
250
|
+
| name | kind | source |
|
|
251
|
+
|------|------|--------|
|
|
252
|
+
| `DATABASE_URL` | env | secret `pg-url` |
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### `kind: cli`
|
|
256
|
+
|
|
257
|
+
```markdown
|
|
258
|
+
## Command
|
|
259
|
+
|
|
260
|
+
`tool init [path]`
|
|
261
|
+
|
|
262
|
+
## Flags
|
|
263
|
+
|
|
264
|
+
| flag | type | default | notes |
|
|
265
|
+
|------|------|---------|-------|
|
|
266
|
+
| `--force` | bool | false | |
|
|
267
|
+
|
|
268
|
+
## Output
|
|
269
|
+
|
|
270
|
+
Describe stdout/stderr format and exit codes.
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 6. Status semantics
|
|
276
|
+
|
|
277
|
+
| status | meaning | may receive deltas? |
|
|
278
|
+
|---|---|---|
|
|
279
|
+
| `draft` | being designed, not implemented | yes |
|
|
280
|
+
| `active` | implemented, tracked | yes |
|
|
281
|
+
| `deprecated` | being removed, kept for reference | no (requires status flip first) |
|
|
282
|
+
| `needs_review` | drift detected, awaiting resolution | no (requires operator or review skill) |
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 7. `design_delta` — the skill output contract
|
|
287
|
+
|
|
288
|
+
Every skill whose work touches a `code_paths` glob of a registered surface MUST include a `design_delta` in its handoff. Skills that touch no registered surface MUST emit `design_delta: none` with a `rationale` — silence is not accepted.
|
|
289
|
+
|
|
290
|
+
### 7.1 Shape
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
design_delta:
|
|
294
|
+
surface_id: api/get-user
|
|
295
|
+
operation: update # create | update | deprecate | none
|
|
296
|
+
base_checksum: sha256:9a8b... # the checksum the skill read
|
|
297
|
+
sections:
|
|
298
|
+
- section: "Response — 200"
|
|
299
|
+
action: replace
|
|
300
|
+
content: |
|
|
301
|
+
| field | type | nullable | notes |
|
|
302
|
+
|-------|------|----------|-------|
|
|
303
|
+
| `id` | `string(uuid)` | no | |
|
|
304
|
+
| `email` | `string(email)` | no | |
|
|
305
|
+
| `createdAt` | `string(iso8601)` | no | |
|
|
306
|
+
| `updatedAt` | `string(iso8601)` | no | added |
|
|
307
|
+
- section: "Known gaps"
|
|
308
|
+
action: remove_line
|
|
309
|
+
match: "missing updatedAt in response"
|
|
310
|
+
- section: "Change log"
|
|
311
|
+
action: append
|
|
312
|
+
content: "2026-11-09 · v1.4.0 · Added updatedAt to response · task T-014 · library/develop"
|
|
313
|
+
code_paths_touched:
|
|
314
|
+
- apps/api/src/routes/user.ts
|
|
315
|
+
rationale: "Added updatedAt field to satisfy client refresh logic."
|
|
316
|
+
task_id: T-014
|
|
317
|
+
skill: library/develop
|
|
318
|
+
idempotent: true
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### 7.2 Actions
|
|
322
|
+
|
|
323
|
+
| action | semantics |
|
|
324
|
+
|---|---|
|
|
325
|
+
| `replace` | replace the named section's body entirely |
|
|
326
|
+
| `append` | append content to the named section |
|
|
327
|
+
| `remove_line` | remove the first line matching `match` in the named section |
|
|
328
|
+
| `prepend` | prepend content to the named section |
|
|
329
|
+
|
|
330
|
+
Any other action is a validation failure.
|
|
331
|
+
|
|
332
|
+
### 7.3 Rules
|
|
333
|
+
|
|
334
|
+
- `base_checksum` MUST match the current `design_checksum`. If it does not, the delta is **rejected** and the task enters `needs_review` (this is the concurrency guard: two skills cannot silently race on one surface).
|
|
335
|
+
- If `operation: create`, `base_checksum` is `null` and `surface_id` MUST NOT already exist.
|
|
336
|
+
- If `operation: deprecate`, `sections` is empty; `status` flips to `deprecated`.
|
|
337
|
+
- `version` is bumped automatically by the orchestrator on every applied delta (minor bump for content, major for structural change — the delta declares `bump: minor|major`, default `minor`).
|
|
338
|
+
- `idempotent: true` means the same delta applied twice produces the same result; `false` means re-application must be rejected (orchestrator enforces via checksum).
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 8. Orchestrator integration
|
|
343
|
+
|
|
344
|
+
### 8.1 Load (before routing)
|
|
345
|
+
|
|
346
|
+
When `route` resolves a capability, the orchestrator MUST:
|
|
347
|
+
|
|
348
|
+
1. Determine the target surface(s) from the task's declared `surface_id` or from matching the task's expected `code_paths`.
|
|
349
|
+
2. Load the matching design doc(s) into the skill's context, frontmatter stripped, body included.
|
|
350
|
+
3. Include the current `design_checksum` in the context so the skill can emit a correct `base_checksum`.
|
|
351
|
+
|
|
352
|
+
If the task touches no registered surface, the orchestrator passes `design_context: none` — the skill is then required to declare whether it *should* have.
|
|
353
|
+
|
|
354
|
+
### 8.2 Write (after handoff)
|
|
355
|
+
|
|
356
|
+
On a validated handoff containing a `design_delta`:
|
|
357
|
+
|
|
358
|
+
1. Load the target file.
|
|
359
|
+
2. Verify `base_checksum` matches (`operation: update`) or surface absent (`operation: create`).
|
|
360
|
+
3. Apply section actions in order.
|
|
361
|
+
4. Recompute `design_checksum` over the new body.
|
|
362
|
+
5. Bump `version`; update `last_reviewed` and `related_tasks`.
|
|
363
|
+
6. Validate the resulting file against the kind schema (§5.3).
|
|
364
|
+
7. Atomic write (§10).
|
|
365
|
+
8. Append a `design_update` event to `journal.ndjson`.
|
|
366
|
+
9. Regenerate `INDEX.md`.
|
|
367
|
+
|
|
368
|
+
On failure at any step: journal `design_delta_rejected`, mark the task `needs_review`, do not write.
|
|
369
|
+
|
|
370
|
+
### 8.3 Resume integration (extend RESUME.md B4)
|
|
371
|
+
|
|
372
|
+
The `RESUME.md` boot drift check (B4) is extended with a **design fingerprint**:
|
|
373
|
+
|
|
374
|
+
```json
|
|
375
|
+
"design_registry": {
|
|
376
|
+
"index_sha256": "sha256:...",
|
|
377
|
+
"surface_count": 42,
|
|
378
|
+
"status_counts": { "active": 40, "draft": 1, "deprecated": 1, "needs_review": 0 }
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Stored in `state.env_fingerprint`. On mismatch at boot: `BLOCKED_DRIFT` with the diff, same as the manifest check. This prevents resuming against a design registry the plan was not built against.
|
|
383
|
+
|
|
384
|
+
### 8.4 The `document` skill is the janitor
|
|
385
|
+
|
|
386
|
+
The `document` capability (internal override in `library/*`) is the designated consolidator:
|
|
387
|
+
|
|
388
|
+
- Normalizes prose
|
|
389
|
+
- Reconciles `Known gaps` against code reality
|
|
390
|
+
- Detects duplicate or overlapping `code_paths` across surfaces
|
|
391
|
+
- Flags `coverage_gap` for unclaimed code
|
|
392
|
+
- Never introduces new facts — only reorganizes what deltas produced
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 9. Drift model
|
|
397
|
+
|
|
398
|
+
Two independent drift detectors, both escalating to `needs_review`.
|
|
399
|
+
|
|
400
|
+
### 9.1 Code drift
|
|
401
|
+
|
|
402
|
+
For each registered surface with `status: active`:
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
changed_files = git diff --name-only <last_reviewed_commit>..HEAD \
|
|
406
|
+
-- $(resolve code_paths)
|
|
407
|
+
if changed_files is non-empty AND design_checksum unchanged since last_reviewed_commit:
|
|
408
|
+
flag: CODE_DRIFT
|
|
409
|
+
surface_id: ...
|
|
410
|
+
files: [...]
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Fallback when git is unavailable: compare mtime of matched files against `last_reviewed`.
|
|
414
|
+
|
|
415
|
+
### 9.2 Dependency drift
|
|
416
|
+
|
|
417
|
+
For each surface, for each `depends_on` entry `S`:
|
|
418
|
+
- If `S`'s `version` incremented since this surface's `last_reviewed` → flag `DEPENDENCY_DRIFT`.
|
|
419
|
+
|
|
420
|
+
### 9.3 Coverage drift
|
|
421
|
+
|
|
422
|
+
For each registered surface, `code_paths` MUST NOT overlap with another surface's `code_paths`. Overlaps and unmatched-but-should-be-matched code are both `COVERAGE_GAP`.
|
|
423
|
+
|
|
424
|
+
The `document` skill runs the coverage audit; CI enforces it.
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## 10. Atomic write protocol
|
|
429
|
+
|
|
430
|
+
Identical to `RESUME.md` §8:
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
1. write <path>.tmp
|
|
434
|
+
2. fsync <path>.tmp
|
|
435
|
+
3. rename <path>.tmp -> <path>
|
|
436
|
+
4. fsync <parent dir>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Journal append after the rename succeeds. Order: journal first, then snapshot (`state.json`), per `RESUME.md` §8 commit pairing.
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## 11. INDEX.md
|
|
444
|
+
|
|
445
|
+
Generated. Never edited by hand. Shape:
|
|
446
|
+
|
|
447
|
+
```markdown
|
|
448
|
+
# Design Registry Index
|
|
449
|
+
|
|
450
|
+
Generated: 2026-11-09T10:42:20Z
|
|
451
|
+
Surfaces: 42 · active 40 · draft 1 · deprecated 1 · needs_review 0
|
|
452
|
+
|
|
453
|
+
| surface_id | kind | app | status | version | last_reviewed | gaps |
|
|
454
|
+
|-----------|------|-----|--------|---------|---------------|------|
|
|
455
|
+
| web/homepage | web | web | active | 1.3.0 | 2026-11-09 | 2 |
|
|
456
|
+
| api/get-user | api | api | active | 1.4.0 | 2026-11-09 | 0 |
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Regenerated:
|
|
460
|
+
- After every applied delta
|
|
461
|
+
- On every orchestrator boot (as part of `resume-report.md` generation)
|
|
462
|
+
- By the `document` skill after a janitor pass
|
|
463
|
+
|
|
464
|
+
Deterministic ordering: sort by `surface_id`.
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 12. CI tests
|
|
469
|
+
|
|
470
|
+
**D-T1 — Schema validation.** Every file under `docs/design/` validates against its `kind` schema.
|
|
471
|
+
|
|
472
|
+
**D-T2 — INDEX determinism.** Regenerate `INDEX.md` from frontmatter; assert byte-equal to committed.
|
|
473
|
+
|
|
474
|
+
**D-T3 — Delta idempotency.** Apply a `idempotent: true` delta twice; assert result is identical to single application.
|
|
475
|
+
|
|
476
|
+
**D-T4 — Checksum guard.** Apply a delta with stale `base_checksum`; assert rejection + `needs_review`.
|
|
477
|
+
|
|
478
|
+
**D-T5 — Code drift.** Modify a file matched by `code_paths` without updating the design; assert `CODE_DRIFT` flag.
|
|
479
|
+
|
|
480
|
+
**D-T6 — Coverage.** Add a new code file under a directory matched by an existing surface's globs without a design delta; assert `COVERAGE_GAP`.
|
|
481
|
+
|
|
482
|
+
**D-T7 — Deprecated guard.** Attempt a delta against `status: deprecated`; assert rejection.
|
|
483
|
+
|
|
484
|
+
**D-T8 — Resume integration.** Mutate `docs/design/` then restart; assert `RESUME.md` B4 produces `BLOCKED_DRIFT` with a design diff.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## 13. Acceptance criteria
|
|
489
|
+
|
|
490
|
+
- [ ] Every code surface in the monorepo is covered by exactly one design doc (`COVERAGE_GAP` count = 0 in CI).
|
|
491
|
+
- [ ] `docs/design/web/homepage.md` alone answers "what's on the homepage" and "what needs adjusting" without reading code.
|
|
492
|
+
- [ ] `docs/design/api/get-user.md` alone answers "what fields, what types, what errors" without reading code.
|
|
493
|
+
- [ ] Every applied delta updates `design_checksum`, `version`, `last_reviewed`, `related_tasks`, and appends to `## Change log`.
|
|
494
|
+
- [ ] `INDEX.md` is regenerable and byte-stable (D-T2 green).
|
|
495
|
+
- [ ] Code drift on any `active` surface produces `needs_review` (D-T5 green).
|
|
496
|
+
- [ ] Resume against a modified registry produces `BLOCKED_DRIFT` (D-T8 green).
|
|
497
|
+
- [ ] No skill can silently touch a registered surface without emitting a `design_delta` or an explicit `design_delta: none`.
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## 14. Non-goals
|
|
502
|
+
|
|
503
|
+
- This contract does **not** prescribe prose style or length beyond the required sections.
|
|
504
|
+
- This contract does **not** replace `HANDOFF.md` or `RESUME.md`; it composes with both.
|
|
505
|
+
- This contract does **not** define the override precedence algorithm — only that the design registry is fingerprinted and drift-checked alongside it.
|
|
506
|
+
- This contract does **not** persist reasoning, chat history, or skill-internal state. Only design facts.
|