@cluesmith/codev 3.0.1 → 3.0.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/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +14 -5
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/attach.d.ts.map +1 -1
- package/dist/agent-farm/commands/attach.js +93 -3
- package/dist/agent-farm/commands/attach.js.map +1 -1
- package/dist/agent-farm/commands/spawn-roles.d.ts +1 -1
- package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts +4 -4
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +47 -0
- package/dist/agent-farm/db/index.js.map +1 -1
- package/dist/agent-farm/db/schema.d.ts +1 -1
- package/dist/agent-farm/db/schema.d.ts.map +1 -1
- package/dist/agent-farm/db/schema.js +1 -1
- package/dist/agent-farm/db/types.d.ts +1 -1
- package/dist/agent-farm/servers/tower-server.js +18 -3
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/state.js +1 -1
- package/dist/agent-farm/state.js.map +1 -1
- package/dist/agent-farm/types.d.ts +2 -2
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/server-utils.d.ts +13 -0
- package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
- package/dist/agent-farm/utils/server-utils.js +38 -0
- package/dist/agent-farm/utils/server-utils.js.map +1 -1
- package/dist/commands/porch/index.d.ts +6 -0
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +83 -0
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/prompts.d.ts.map +1 -1
- package/dist/commands/porch/prompts.js +4 -7
- package/dist/commands/porch/prompts.js.map +1 -1
- package/dist/lib/forge-contracts.d.ts +1 -1
- package/dist/lib/forge-contracts.d.ts.map +1 -1
- package/dist/lib/forge.d.ts.map +1 -1
- package/dist/lib/forge.js +24 -6
- package/dist/lib/forge.js.map +1 -1
- package/package.json +2 -2
- package/scripts/forge/linear/auth-status.sh +15 -0
- package/scripts/forge/linear/issue-comment.sh +38 -0
- package/scripts/forge/linear/issue-list.sh +35 -0
- package/scripts/forge/linear/issue-view.sh +37 -0
- package/scripts/forge/linear/recently-closed.sh +45 -0
- package/scripts/forge/linear/user-identity.sh +15 -0
- package/skeleton/.claude/skills/update-arch-docs/SKILL.md +107 -0
- package/skeleton/protocols/maintain/protocol.md +69 -2
- package/skeleton/protocols/spir/protocol.md +4 -3
- package/skeleton/resources/risk-triage.md +1 -1
- package/skeleton/templates/arch.md +100 -30
- package/skeleton/templates/lessons-learned.md +45 -7
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Forge concept: issue-list (Linear via GraphQL API)
|
|
3
|
+
# Input: CODEV_LINEAR_TEAM (team key, e.g. "ENG")
|
|
4
|
+
# Output: JSON [{number, title, url, labels, createdAt, author, assignees}]
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
if [ -z "$LINEAR_API_KEY" ]; then
|
|
8
|
+
echo "LINEAR_API_KEY is not set" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
FILTER='{ state: { type: { nin: ["completed", "canceled"] } } }'
|
|
13
|
+
if [ -n "$CODEV_LINEAR_TEAM" ]; then
|
|
14
|
+
FILTER="$(jq -n --arg team "$CODEV_LINEAR_TEAM" '{
|
|
15
|
+
team: { key: { eq: $team } },
|
|
16
|
+
state: { type: { nin: ["completed", "canceled"] } }
|
|
17
|
+
}')"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
curl -sf -X POST https://api.linear.app/graphql \
|
|
21
|
+
-H "Content-Type: application/json" \
|
|
22
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
23
|
+
-d "$(jq -n --argjson filter "$FILTER" '{
|
|
24
|
+
query: "query($filter: IssueFilter) { issues(filter: $filter, first: 200) { nodes { identifier title url labels { nodes { name } } createdAt assignee { displayName } creator { displayName } } } }",
|
|
25
|
+
variables: { filter: $filter }
|
|
26
|
+
}')" \
|
|
27
|
+
| jq '[.data.issues.nodes[] | {
|
|
28
|
+
number: .identifier,
|
|
29
|
+
title: .title,
|
|
30
|
+
url: .url,
|
|
31
|
+
labels: [.labels.nodes[] | { name: .name }],
|
|
32
|
+
createdAt: .createdAt,
|
|
33
|
+
author: (if .creator then { login: .creator.displayName } else null end),
|
|
34
|
+
assignees: (if .assignee then [{ login: .assignee.displayName }] else [] end)
|
|
35
|
+
}]'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Forge concept: issue-view (Linear via GraphQL API)
|
|
3
|
+
# Input: CODEV_ISSUE_ID (e.g. "ENG-123")
|
|
4
|
+
# Output: JSON {title, body, state, comments[]}
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
if [ -z "$LINEAR_API_KEY" ]; then
|
|
8
|
+
echo "LINEAR_API_KEY is not set" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if [ -z "$CODEV_ISSUE_ID" ]; then
|
|
13
|
+
echo "CODEV_ISSUE_ID is not set" >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
curl -sf -X POST https://api.linear.app/graphql \
|
|
18
|
+
-H "Content-Type: application/json" \
|
|
19
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
20
|
+
-d "$(jq -n --arg id "$CODEV_ISSUE_ID" '{
|
|
21
|
+
query: "query($id: String!) { issueVcsByFilter: issues(filter: { identifier: { eq: $id } }) { nodes { title description state { name } comments { nodes { body createdAt user { displayName } } } } } }",
|
|
22
|
+
variables: { id: $id }
|
|
23
|
+
}')" \
|
|
24
|
+
| jq 'if (.data.issueVcsByFilter.nodes | length) == 0 then
|
|
25
|
+
error("issue not found: \(env.CODEV_ISSUE_ID)")
|
|
26
|
+
else
|
|
27
|
+
.data.issueVcsByFilter.nodes[0] | {
|
|
28
|
+
title: .title,
|
|
29
|
+
body: (.description // ""),
|
|
30
|
+
state: .state.name,
|
|
31
|
+
comments: [.comments.nodes[] | {
|
|
32
|
+
body: .body,
|
|
33
|
+
createdAt: .createdAt,
|
|
34
|
+
author: { login: .user.displayName }
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
end'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Forge concept: recently-closed (Linear via GraphQL API)
|
|
3
|
+
# Input: CODEV_LINEAR_TEAM, CODEV_SINCE_DATE (optional, ISO date)
|
|
4
|
+
# Output: JSON [{number, title, url, labels, createdAt, closedAt}]
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
if [ -z "$LINEAR_API_KEY" ]; then
|
|
8
|
+
echo "LINEAR_API_KEY is not set" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
FILTER='{ state: { type: { in: ["completed", "canceled"] } } }'
|
|
13
|
+
if [ -n "$CODEV_LINEAR_TEAM" ] && [ -n "$CODEV_SINCE_DATE" ]; then
|
|
14
|
+
FILTER="$(jq -n --arg team "$CODEV_LINEAR_TEAM" --arg since "$CODEV_SINCE_DATE" '{
|
|
15
|
+
team: { key: { eq: $team } },
|
|
16
|
+
state: { type: { in: ["completed", "canceled"] } },
|
|
17
|
+
completedAt: { gte: $since }
|
|
18
|
+
}')"
|
|
19
|
+
elif [ -n "$CODEV_LINEAR_TEAM" ]; then
|
|
20
|
+
FILTER="$(jq -n --arg team "$CODEV_LINEAR_TEAM" '{
|
|
21
|
+
team: { key: { eq: $team } },
|
|
22
|
+
state: { type: { in: ["completed", "canceled"] } }
|
|
23
|
+
}')"
|
|
24
|
+
elif [ -n "$CODEV_SINCE_DATE" ]; then
|
|
25
|
+
FILTER="$(jq -n --arg since "$CODEV_SINCE_DATE" '{
|
|
26
|
+
state: { type: { in: ["completed", "canceled"] } },
|
|
27
|
+
completedAt: { gte: $since }
|
|
28
|
+
}')"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
curl -sf -X POST https://api.linear.app/graphql \
|
|
32
|
+
-H "Content-Type: application/json" \
|
|
33
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
34
|
+
-d "$(jq -n --argjson filter "$FILTER" '{
|
|
35
|
+
query: "query($filter: IssueFilter) { issues(filter: $filter, first: 200, orderBy: updatedAt) { nodes { identifier title url labels { nodes { name } } createdAt completedAt } } }",
|
|
36
|
+
variables: { filter: $filter }
|
|
37
|
+
}')" \
|
|
38
|
+
| jq '[.data.issues.nodes[] | {
|
|
39
|
+
number: .identifier,
|
|
40
|
+
title: .title,
|
|
41
|
+
url: .url,
|
|
42
|
+
labels: [.labels.nodes[] | { name: .name }],
|
|
43
|
+
createdAt: .createdAt,
|
|
44
|
+
closedAt: .completedAt
|
|
45
|
+
}]'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Forge concept: user-identity (Linear via GraphQL API)
|
|
3
|
+
# Output: plain text display name
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
if [ -z "$LINEAR_API_KEY" ]; then
|
|
7
|
+
echo "LINEAR_API_KEY is not set" >&2
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
curl -sf -X POST https://api.linear.app/graphql \
|
|
12
|
+
-H "Content-Type: application/json" \
|
|
13
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
14
|
+
-d '{"query":"{ viewer { displayName } }"}' \
|
|
15
|
+
| jq -r '.data.viewer.displayName'
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-arch-docs
|
|
3
|
+
description: Audit, prune, and update the project's architecture documentation — `codev/resources/arch.md` and `codev/resources/lessons-learned.md`. Use this skill when running MAINTAIN's arch-doc step, or when asked to update / audit / prune `codev/resources/arch.md` or `codev/resources/lessons-learned.md`. The skill is opinionated about what NOT to include in these files (per-spec changelogs, exhaustive enumerations, aspirational state, duplicate meta-spec content) and ships two operating modes: diff-mode (apply a specific change) and audit-mode (propose cuts with reasons). It edits files directly via normal file-edit tooling and does not invoke destructive shell commands.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# update-arch-docs
|
|
7
|
+
|
|
8
|
+
This skill maintains two governance documents:
|
|
9
|
+
|
|
10
|
+
- `codev/resources/arch.md` — the project's architecture document.
|
|
11
|
+
- `codev/resources/lessons-learned.md` — durable engineering wisdom extracted from reviews.
|
|
12
|
+
|
|
13
|
+
It is invoked by the MAINTAIN protocol's documentation step, and ad-hoc whenever someone needs to update, audit, or prune either file. The skill is opinionated about *what does not belong* in these files. Use it whenever a doc change touches arch.md or lessons-learned.md, even if the change is just an addition.
|
|
14
|
+
|
|
15
|
+
## What this skill does NOT do
|
|
16
|
+
|
|
17
|
+
These are the patterns that have, in practice, caused arch.md and lessons-learned.md to grow without bound. Treat them as bright-line rejections during both audit-mode and diff-mode work.
|
|
18
|
+
|
|
19
|
+
### In arch.md
|
|
20
|
+
|
|
21
|
+
- **Per-file enumerations** that go stale the moment they're written. Document the *shape* of a directory and the handful of load-bearing files; do not list every file. `git ls-files` is authoritative; the doc is for orientation.
|
|
22
|
+
- **Per-spec changelog sections** ("Spec 0042 added X, Spec 0073 changed Y"). Architecture is current state, not history. The git log + the spec/review documents own the changelog framing.
|
|
23
|
+
- **Specs/plans tables** that mirror the contents of `codev/specs/` and `codev/plans/`. These are duplicative and rot quickly. Link to the directory; do not paginate it into the doc.
|
|
24
|
+
- **Aspirational state** ("we plan to…", "in the next phase we'll…"). That belongs in the relevant meta-spec or roadmap doc, not in the architecture body. arch.md describes what *is*, not what *might be*.
|
|
25
|
+
- **Date-stamped narrative** ("As of 2026-Q2, the system uses…"). Dates make the doc look fresh while making it harder to maintain. Use git log + commit dates for temporal context.
|
|
26
|
+
- **Duplication of meta-spec content**. If a subsystem has its own meta-spec under `codev/architecture/<domain>.md` or under `codev/specs/`, arch.md should carry a 1-paragraph summary plus a pointer — not a copy.
|
|
27
|
+
- **Retired-component graveyards**. When a component is removed, delete its section. `git log` retains history; an arch.md that describes things that no longer exist is misleading.
|
|
28
|
+
|
|
29
|
+
### In lessons-learned.md
|
|
30
|
+
|
|
31
|
+
- **Spec-narrow recipes** that only matter inside the originating feature ("In spec 0073 we found that the rate limiter needs X"). These belong in the spec's review document, not in lessons-learned.md. lessons-learned.md captures patterns that apply *across* specs.
|
|
32
|
+
- **Multi-paragraph entries**. If a lesson needs more than 1–3 sentences to land, it is either two lessons fused together or it is documentation that belongs elsewhere.
|
|
33
|
+
- **Duplicate adjacent entries**. Fold variations of the same lesson into one entry. Two entries that say the same thing are louder, not clearer.
|
|
34
|
+
- **Spec-numbered narrative entries** ("Lesson from #0468:…"). Link to the review if needed; the lesson itself should be stated as a general principle.
|
|
35
|
+
|
|
36
|
+
### In either file (process)
|
|
37
|
+
|
|
38
|
+
- **Destructive shell commands**. The skill must not invoke `rm -rf`, `git rm`, or destructive `sed` scripts. All edits go through the normal Edit tool. The MAINTAIN PR diff is the human-confirmation step; that's enough.
|
|
39
|
+
|
|
40
|
+
## arch.md vs. lessons-learned.md (two-doc framing)
|
|
41
|
+
|
|
42
|
+
Treat the two files as siblings with different purposes. When in doubt about which file a fact belongs in, route by purpose:
|
|
43
|
+
|
|
44
|
+
| Purpose | Goes in |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Current system shape — services, transports, key mental models | `arch.md` |
|
|
47
|
+
| Mechanism for a unique subsystem | `arch.md` (subsystem section) — or its own meta-spec if the mechanism is large enough to warrant one, with arch.md keeping a 1-paragraph summary + pointer |
|
|
48
|
+
| Pointers ("see meta-spec X for details") | `arch.md` |
|
|
49
|
+
| A durable engineering pattern that applies across multiple specs | `lessons-learned.md` |
|
|
50
|
+
| A system-shape surprise verified-wrong in production ("looks like X but isn't") | `arch.md` § "Verified-Wrong Assumptions" — *not* lessons-learned.md, because it's a property of the system, not a general pattern |
|
|
51
|
+
|
|
52
|
+
The "system-shape surprise" routing is the one most often gotten wrong. If a future reader needs to know "the system *looks* like X but actually does Y", that is system shape and lives in arch.md. If they need to know "we learned that doing X is generally a bad idea", that is engineering wisdom and lives in lessons-learned.md.
|
|
53
|
+
|
|
54
|
+
## Sizing by purpose, not by line count
|
|
55
|
+
|
|
56
|
+
There is no line-count budget for either file. The right size for each section is determined by what the section needs to do. If a subsystem genuinely has unique mechanism that takes 80 lines to explain clearly, 80 lines is the right size. If a subsystem can be described in 5 lines and a pointer to a meta-spec, 5 lines is right.
|
|
57
|
+
|
|
58
|
+
What's *wrong* is bulk that comes from any of the patterns in "What this skill does NOT do" above. Strip those, and the file's size will land where it belongs.
|
|
59
|
+
|
|
60
|
+
When proposing a section, ask: "Could a future reader skip this section without losing anything load-bearing?" If yes, the section should not exist. The doc's purpose is orientation, not completeness.
|
|
61
|
+
|
|
62
|
+
## Mode: diff-mode (apply a specific change)
|
|
63
|
+
|
|
64
|
+
Use diff-mode when the request is specific: "add a section about the new caching layer," "update the Glossary entry for Tower," "remove the reference to the deleted dashboard-server."
|
|
65
|
+
|
|
66
|
+
In diff-mode:
|
|
67
|
+
|
|
68
|
+
1. Find the smallest section that needs to change.
|
|
69
|
+
2. Apply the change via the Edit tool.
|
|
70
|
+
3. If the change adds new content, run a quick sanity check against "What this skill does NOT do" before saving — make sure the new content is current state, not aspirational; not duplicative of a meta-spec; not a per-spec changelog entry.
|
|
71
|
+
4. Surface the resulting diff for review.
|
|
72
|
+
|
|
73
|
+
Diff-mode is fast. It is the right mode for ~80% of post-MAINTAIN documentation work.
|
|
74
|
+
|
|
75
|
+
## Mode: audit-mode (identify what to cut)
|
|
76
|
+
|
|
77
|
+
Use audit-mode when the request is general: "the doc feels stale," "MAINTAIN says it's time to prune," "review arch.md against the principles."
|
|
78
|
+
|
|
79
|
+
In audit-mode:
|
|
80
|
+
|
|
81
|
+
1. Read the file end-to-end.
|
|
82
|
+
2. For each section in arch.md, run through the per-section pruning checklist (from the MAINTAIN protocol):
|
|
83
|
+
- Does it describe *current state*? If aspirational, the section moves to a meta-spec; the arch.md keeps a 1-paragraph summary + pointer (or nothing, if the meta-spec stands on its own).
|
|
84
|
+
- Does it duplicate a meta-spec? If yes, replace with a 1-paragraph summary + pointer.
|
|
85
|
+
- Is it a per-file enumeration that's gone stale? If yes, prune to the directory shape + a few key files.
|
|
86
|
+
- Is it a changelog/narrative section ("Spec 0042 added X")? If yes, absorb the architecturally-relevant facts and remove the spec-numbered framing.
|
|
87
|
+
- Is the component still alive? If retired, delete the section entirely.
|
|
88
|
+
3. For each entry in lessons-learned.md, run the per-entry checklist:
|
|
89
|
+
- Is it cross-applicable beyond the spec that produced it? If no, remove (the lesson belongs in the spec's review).
|
|
90
|
+
- Is it terse (1–3 sentences)? If multi-paragraph, split or compress.
|
|
91
|
+
- Is the topic section the right one? If filed under "Architecture (continued)" or a spec-numbered section, move it to the right topical home.
|
|
92
|
+
- Is it a duplicate of an adjacent entry? If yes, fold them.
|
|
93
|
+
4. **When in doubt, KEEP.** This rule comes from the MAINTAIN protocol and applies in audit-mode too. A confident cut is better than three speculative ones. Bias toward fewer, higher-confidence proposals with clear rationale; do not chase a maximum cut count.
|
|
94
|
+
5. Apply the cuts via the Edit tool — the skill does not produce a "candidate-cuts list and stop." The diff *is* the proposal. The MAINTAIN PR review is the human-confirmation step.
|
|
95
|
+
6. Surface a short reason alongside each cut in the run file (`codev/maintain/NNNN.md`) so PR reviewers can evaluate intent ("removed because: per-spec changelog framing"; "compressed because: duplicates the orchestrator meta-spec").
|
|
96
|
+
|
|
97
|
+
Audit-mode is slower than diff-mode and produces larger diffs. Reserve it for explicit audit invocations, not for routine doc updates.
|
|
98
|
+
|
|
99
|
+
## Output contract
|
|
100
|
+
|
|
101
|
+
The skill commits to the following:
|
|
102
|
+
|
|
103
|
+
- It edits `codev/resources/arch.md` and `codev/resources/lessons-learned.md` directly via the Edit tool.
|
|
104
|
+
- It does not invoke destructive shell commands (no `rm -rf`, no `git rm`, no destructive `sed`). File deletions happen only through Edit removing the relevant content; whole-file removal would be a structural change that is out of scope for this skill.
|
|
105
|
+
- In audit-mode, every removal is paired with a one-line reason in the MAINTAIN run file's `## Audit Findings` section. Rationale lives there so reviewers can evaluate intent without re-deriving it from the diff.
|
|
106
|
+
- The skill does not modify other files (specs, plans, reviews, source code). If a fact belongs somewhere else, the skill flags it; it does not move it.
|
|
107
|
+
- The skill does not edit live arch.md or lessons-learned.md content as a side effect of being read or invoked — only when the user/MAINTAIN protocol explicitly asks for an update or audit.
|
|
@@ -10,6 +10,23 @@ MAINTAIN is a single-pass maintenance protocol for keeping codebases healthy. Th
|
|
|
10
10
|
- `codev/resources/arch.md` - Architecture documentation
|
|
11
11
|
- `codev/resources/lessons-learned.md` - Extracted wisdom from reviews
|
|
12
12
|
|
|
13
|
+
The two governance docs are siblings with **different purposes**: `arch.md` owns system shape (services, transports, mental models, verified-wrong assumptions about *this* system); `lessons-learned.md` owns durable engineering wisdom that applies *across* specs. Use the routing matrix below to decide where each fact belongs.
|
|
14
|
+
|
|
15
|
+
### Lives where: routing facts to the right home
|
|
16
|
+
|
|
17
|
+
| Type of fact/insight | Lives in |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Current system shape (services, transports, key mental models) | `codev/resources/arch.md` |
|
|
20
|
+
| Mechanism for a unique subsystem | `codev/resources/arch.md` (subsystem section) OR a meta-spec under `codev/architecture/<domain>.md` if the mechanism is large enough to warrant its own doc |
|
|
21
|
+
| A durable engineering pattern that applies across multiple specs | `codev/resources/lessons-learned.md` |
|
|
22
|
+
| A spec-narrow fix recipe (only relevant inside the originating feature) | Spec review only — does NOT belong in `lessons-learned.md` |
|
|
23
|
+
| A system-shape surprise verified-wrong in production ("looks like X but isn't") | `codev/resources/arch.md` § "Verified-Wrong Assumptions" |
|
|
24
|
+
| Aspirational architectural direction (where we want to go) | The relevant meta-spec or roadmap doc, NOT `arch.md` body |
|
|
25
|
+
| A changelog entry ("we shipped X in spec Y on date Z") | `git log` + the spec/review document — NOT `arch.md`, NOT `lessons-learned.md` |
|
|
26
|
+
| A retired or removed component | Delete the section entirely; do NOT keep a "retired components" graveyard. (`git log` retains history.) |
|
|
27
|
+
|
|
28
|
+
The most commonly-misrouted entry is the system-shape surprise. If a future reader needs to know "the system *looks* like X but actually does Y," that is system shape and lives in `arch.md`. If they need to know "we learned that doing X is generally a bad idea," that is engineering wisdom and lives in `lessons-learned.md`.
|
|
29
|
+
|
|
13
30
|
## When to Use
|
|
14
31
|
|
|
15
32
|
- Before a release (clean slate for shipping)
|
|
@@ -90,14 +107,54 @@ For each finding from the audit:
|
|
|
90
107
|
|
|
91
108
|
### Step 3: Sync Documentation
|
|
92
109
|
|
|
110
|
+
Step 3 is split into two sub-steps: **Audit first, then update.** This split exists because `arch.md` and `lessons-learned.md` accumulate without bound when MAINTAIN does only "what's new" — the audit pass surfaces what should be cut so the update pass is not purely additive.
|
|
111
|
+
|
|
112
|
+
The `update-arch-docs` skill (at `.claude/skills/update-arch-docs/SKILL.md`) is invoked by both sub-steps. Read it before starting Step 3 so the discipline is fresh.
|
|
113
|
+
|
|
114
|
+
#### Step 3a: Audit documentation
|
|
115
|
+
|
|
116
|
+
Invoke the `update-arch-docs` skill in **audit-mode**. The skill reads `codev/resources/arch.md` and `codev/resources/lessons-learned.md` end-to-end against the discipline below and produces a candidate-cuts list (with reasons) recorded in the run file (`codev/maintain/NNNN.md`) under a new `## Audit Findings` section before any edits land.
|
|
117
|
+
|
|
118
|
+
**Per-arch.md-section pruning checklist** — for each section in `arch.md`, ask:
|
|
119
|
+
- Does it describe **current state**? If aspirational, the section moves to a meta-spec; `arch.md` keeps a 1-paragraph summary + pointer (or nothing, if the meta-spec stands on its own).
|
|
120
|
+
- Does it duplicate a meta-spec? If yes, replace with a 1-paragraph summary + pointer.
|
|
121
|
+
- Is it a per-file enumeration that's gone stale? If yes, prune to the directory shape + a few key files.
|
|
122
|
+
- Is it a changelog/narrative section ("Spec 0042 added X")? If yes, absorb the architecturally-relevant facts and remove the spec-numbered framing.
|
|
123
|
+
- Is the component still alive? If retired, delete the section entirely.
|
|
124
|
+
|
|
125
|
+
**Per-lessons-learned.md-entry pruning checklist** — for each entry, ask:
|
|
126
|
+
- Is it cross-applicable beyond the spec that produced it? If no, remove (the lesson belongs in the spec's review).
|
|
127
|
+
- Is it terse (1–3 sentences)? If multi-paragraph, split or compress.
|
|
128
|
+
- Is the topic section the right home? If filed under "Architecture (continued)" or a spec-numbered section, move it to the right topical home.
|
|
129
|
+
- Is it a duplicate of an adjacent entry? If yes, fold them.
|
|
130
|
+
|
|
131
|
+
**Sample audit prompt** (paste into the skill invocation if you want a baseline checklist run):
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
Audit codev/resources/arch.md and codev/resources/lessons-learned.md against the
|
|
135
|
+
discipline in the update-arch-docs skill. For each section/entry, run the per-
|
|
136
|
+
arch.md-section and per-lessons-learned.md-entry pruning checklists from the
|
|
137
|
+
MAINTAIN protocol (Step 3a). Produce a candidate-cuts list with one-line reasons.
|
|
138
|
+
Bias toward fewer, higher-confidence cuts ("when in doubt, KEEP"). Record the
|
|
139
|
+
findings in the current run file's ## Audit Findings section before applying.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**When in doubt, KEEP.** This rule is preserved from the older Step 3. A confident cut is better than three speculative ones. The audit pass is a *proposal*; the architect's PR review confirms it.
|
|
143
|
+
|
|
144
|
+
#### Step 3b: Update documentation
|
|
145
|
+
|
|
146
|
+
Apply the audit decisions from Step 3a, plus any additive content needed.
|
|
147
|
+
|
|
93
148
|
**arch.md**: Compare documented structure with actual codebase. Update:
|
|
94
149
|
- Directory structure
|
|
95
150
|
- Component descriptions (explain HOW things work, not just WHAT)
|
|
96
151
|
- Key files and their purposes
|
|
97
|
-
- Remove references to deleted code
|
|
152
|
+
- Remove references to deleted code (per Step 3a audit findings)
|
|
98
153
|
- Add new components/utilities
|
|
99
154
|
|
|
100
|
-
**lessons-learned.md**: Scan `codev/reviews/` for new reviews since last run. Extract lessons that are actionable, durable, and general.
|
|
155
|
+
**lessons-learned.md**: Scan `codev/reviews/` for new reviews since last run. Extract lessons that are actionable, durable, and general. Apply Step 3a's per-entry cuts.
|
|
156
|
+
|
|
157
|
+
For specific additive changes, invoke `update-arch-docs` in **diff-mode** — it applies the smallest section update needed.
|
|
101
158
|
|
|
102
159
|
**CLAUDE.md / AGENTS.md**: Diff the two files. They must be identical. Update the stale one.
|
|
103
160
|
|
|
@@ -133,6 +190,16 @@ Each run creates `codev/maintain/NNNN.md`:
|
|
|
133
190
|
|
|
134
191
|
<key commits summary>
|
|
135
192
|
|
|
193
|
+
## Audit Findings
|
|
194
|
+
|
|
195
|
+
Recorded by Step 3a (Audit documentation) before any edits land. One line per candidate cut.
|
|
196
|
+
|
|
197
|
+
### arch.md
|
|
198
|
+
- <section-name>: <reason for proposed cut/compression>
|
|
199
|
+
|
|
200
|
+
### lessons-learned.md
|
|
201
|
+
- <entry>: <reason>
|
|
202
|
+
|
|
136
203
|
## What Was Done
|
|
137
204
|
|
|
138
205
|
### Dead Code Removed
|
|
@@ -504,9 +504,10 @@ Execute for each phase in the plan. Each phase follows a build-verify cycle.
|
|
|
504
504
|
- Enhance documentation
|
|
505
505
|
|
|
506
506
|
3. **Update Architecture Documentation**
|
|
507
|
-
- Update `codev/resources/arch.md` with new modules, utilities,
|
|
508
|
-
-
|
|
509
|
-
-
|
|
507
|
+
- Update `codev/resources/arch.md` and `codev/resources/lessons-learned.md` with new modules, utilities, architectural changes, and durable engineering wisdom uncovered during this work
|
|
508
|
+
- Use the **`update-arch-docs` skill** (at `.claude/skills/update-arch-docs/SKILL.md`) to apply changes — the skill encodes the discipline for what NOT to include and the two-doc framing (arch.md owns system shape; lessons-learned.md owns durable engineering wisdom)
|
|
509
|
+
- Follow guidance in the MAINTAIN protocol's Step 3 ("Sync Documentation") for structure, the "Lives where" routing matrix, and pruning checklists
|
|
510
|
+
- Ensure both docs reflect current state
|
|
510
511
|
|
|
511
512
|
4. **Revision Requirements** (MANDATORY)
|
|
512
513
|
- Update README.md with any new features or changes
|
|
@@ -41,7 +41,7 @@ gh pr view <N> --json files | jq '.files[].path'
|
|
|
41
41
|
| `packages/codev/src/state/` | State management | High |
|
|
42
42
|
| `codev/protocols/` | Protocol definitions | High |
|
|
43
43
|
| `codev-skeleton/protocols/` | Protocol templates | High |
|
|
44
|
-
| `packages/codev/src/commands
|
|
44
|
+
| `packages/codev/src/agent-farm/commands/` | Agent Farm commands | Medium |
|
|
45
45
|
| `packages/codev/src/commands/consult/` | Consultation system | Medium |
|
|
46
46
|
| `packages/codev/src/lib/` | Shared libraries | Medium |
|
|
47
47
|
| `packages/codev/src/commands/` (other) | CLI commands | Medium |
|
|
@@ -1,56 +1,126 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The architecture document for this project. Skim it to orient yourself; reach for the meta-specs under `codev/architecture/` (if any) or the relevant subsystem section for depth.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **How to use this template**: Each section below is a stub with a one-line "skip if N/A" hint. Delete sections that don't apply to your project — small projects often only need TL;DR, Repository Layout & Stack, and Updating This Document. Bigger systems will fill in more. The goal is orientation, not completeness.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## TL;DR
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A 2–4 sentence summary of what this project is, the language/stack, the deployment shape, and the single most important mental model a new contributor needs.
|
|
10
|
+
|
|
11
|
+
*Example*: "A monorepo of TypeScript packages and a CLI. The CLI talks to a long-running orchestrator process (Tower) over WebSockets. The orchestrator manages git worktrees, one per builder. The mental model is: 'CLI = thin client; Tower = state owner.'"
|
|
12
|
+
|
|
13
|
+
## Repository Layout & Stack
|
|
14
|
+
|
|
15
|
+
The shape of the repo and the languages/frameworks in use. Not a per-file enumeration — a `tree -L 2` view plus 2–3 lines on each top-level directory's role is plenty.
|
|
16
|
+
|
|
17
|
+
> *Skip if N/A: a single-package project that's well-served by `package.json` alone.*
|
|
10
18
|
|
|
11
19
|
```
|
|
12
20
|
project-root/
|
|
13
|
-
├──
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
└── [your code] # Project source code
|
|
21
|
+
├── packages/ # Workspace packages
|
|
22
|
+
├── codev/ # Specs, plans, reviews, protocol files
|
|
23
|
+
├── docs/ # User-facing documentation
|
|
24
|
+
└── ...
|
|
18
25
|
```
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
**Stack**: language version(s), framework(s), package manager. Avoid pinning exact patch versions; the lockfile is authoritative for those.
|
|
28
|
+
|
|
29
|
+
## Per-Subsystem Mechanism
|
|
30
|
+
|
|
31
|
+
For each subsystem with **unique mechanism** — something a reader cannot derive from reading the code in 5 minutes — give it a section here. Mechanism means: how the pieces fit together, what invariants hold, what surprised the team.
|
|
32
|
+
|
|
33
|
+
> *Skip if N/A: subsystems whose mechanism is well-conveyed by the code itself or by a meta-spec under `codev/architecture/<domain>.md`. In that case, replace this section with a 1-paragraph summary + pointer.*
|
|
34
|
+
|
|
35
|
+
### [Subsystem name]
|
|
36
|
+
|
|
37
|
+
**Purpose**: One sentence on what this subsystem owns.
|
|
38
|
+
|
|
39
|
+
**Mechanism**: How it works. Invariants. Failure modes worth knowing.
|
|
40
|
+
|
|
41
|
+
**Pointer**: `codev/architecture/<domain>.md` (if a meta-spec exists).
|
|
42
|
+
|
|
43
|
+
## Apps Roster
|
|
44
|
+
|
|
45
|
+
For projects that ship multiple deployable apps — a CLI, a web service, a worker, etc. List them with a one-liner each.
|
|
46
|
+
|
|
47
|
+
> *Skip if N/A: single-app projects.*
|
|
21
48
|
|
|
22
|
-
|
|
49
|
+
| App | Purpose | Entry point |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `cli` | Command-line interface | `packages/cli/src/index.ts` |
|
|
52
|
+
| `worker` | Background job runner | `apps/worker/src/main.ts` |
|
|
23
53
|
|
|
24
|
-
|
|
54
|
+
## Packages Roster
|
|
25
55
|
|
|
26
|
-
|
|
56
|
+
For monorepos. List the workspace packages with a one-liner each. Do not duplicate `pnpm-workspace.yaml` or `package.json` — link to them.
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
> *Skip if N/A: non-monorepo projects.*
|
|
29
59
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
60
|
+
| Package | Purpose |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `@org/core` | Domain logic, no I/O |
|
|
63
|
+
| `@org/cli` | CLI entry point, depends on core |
|
|
33
64
|
|
|
34
|
-
##
|
|
65
|
+
## Verified-Wrong Assumptions
|
|
35
66
|
|
|
36
|
-
|
|
67
|
+
System-shape surprises that have been verified wrong in production. Each entry is one or two sentences: *"It looks like X but is actually Y. We learned this when ..."*. This section earns its keep by saving future readers from the same mistake.
|
|
37
68
|
|
|
38
|
-
|
|
69
|
+
> *Skip if N/A: nothing has surprised you yet. Add entries as they're discovered.*
|
|
39
70
|
|
|
40
|
-
|
|
71
|
+
- *Example*: "It looks like the CLI talks to Tower over HTTP, but the WebSocket bidirectional channel is the actual transport — the HTTP routes are only used for `/health` and one-off lookups. We learned this when adding a new command broke because we wrote it as a fetch call."
|
|
41
72
|
|
|
42
|
-
|
|
43
|
-
|------------|---------|---------------|
|
|
44
|
-
| Example | ... | [docs](url) |
|
|
73
|
+
## Updating This Document
|
|
45
74
|
|
|
46
|
-
|
|
75
|
+
This is a single-page orientation doc, not a wiki. Keep it sized to its purpose.
|
|
47
76
|
|
|
48
|
-
|
|
77
|
+
### When to update
|
|
49
78
|
|
|
50
|
-
|
|
79
|
+
- After a MAINTAIN run that changed system shape.
|
|
80
|
+
- When a subsystem's mechanism changes meaningfully (not when one file gets renamed).
|
|
81
|
+
- When a verified-wrong assumption is discovered.
|
|
82
|
+
- *Not* every spec; specs already produce reviews and git history. Don't duplicate that here.
|
|
51
83
|
|
|
52
|
-
|
|
84
|
+
### How to update
|
|
53
85
|
|
|
54
|
-
|
|
86
|
+
Use the `update-arch-docs` skill. It runs in two modes:
|
|
87
|
+
|
|
88
|
+
- **diff-mode**: apply a specific change to the smallest section that needs updating.
|
|
89
|
+
- **audit-mode**: read the doc end-to-end against the discipline below and propose cuts with reasons.
|
|
90
|
+
|
|
91
|
+
The skill edits this file directly via normal file-edit tooling. It does not invoke destructive shell commands; everything goes through Edit. The MAINTAIN PR diff is the human-confirmation step.
|
|
92
|
+
|
|
93
|
+
### What NOT to put in
|
|
94
|
+
|
|
95
|
+
The main pressure on this document is unchecked growth. Reject all of the following:
|
|
96
|
+
|
|
97
|
+
- **Per-file enumerations** that go stale. Document directory shape and key files; let `git ls-files` be authoritative for the rest.
|
|
98
|
+
- **Per-spec changelog sections** ("Spec 0042 added X"). The git log + the spec/review docs own this framing. Architecture is current state, not history.
|
|
99
|
+
- **Specs/plans tables** that mirror `codev/specs/` and `codev/plans/`. Link to the directory; do not paginate it here.
|
|
100
|
+
- **Aspirational state** ("we plan to…"). That's a meta-spec or a roadmap doc, not architecture.
|
|
101
|
+
- **Date-stamped narrative** ("As of 2026-Q2…"). Looks fresh; ages worse than a calendar.
|
|
102
|
+
- **Duplication of meta-spec content**. If a subsystem has a meta-spec, this doc carries a 1-paragraph summary plus a pointer.
|
|
103
|
+
- **Retired-component graveyards**. When a component is removed, delete its section. `git log` keeps the history.
|
|
104
|
+
|
|
105
|
+
### Sanity-check checklist
|
|
106
|
+
|
|
107
|
+
Before committing an arch.md change, run through these:
|
|
108
|
+
|
|
109
|
+
1. Does the section describe **current state**, not aspiration?
|
|
110
|
+
2. Does it duplicate a meta-spec? If yes, replace with a summary + pointer.
|
|
111
|
+
3. Is the section orienting (worth a reader's 30 seconds), or is it exhaustive?
|
|
112
|
+
4. Could a future reader skip this section without losing anything load-bearing?
|
|
113
|
+
5. If audit-mode produced cuts, does each cut have a one-line reason in the MAINTAIN run file?
|
|
114
|
+
6. Does the doc still feel like it can be skimmed end-to-end in under 5 minutes?
|
|
115
|
+
|
|
116
|
+
### Note on propagation
|
|
117
|
+
|
|
118
|
+
By design, **`codev init`, `codev adopt`, and `codev update` do not copy framework templates** (including this `arch.md` template) into the consuming project's filesystem. They are framework files that resolve at runtime from the installed `@cluesmith/codev` npm package — see `packages/codev/src/commands/init.ts` and `adopt.ts` (the `// Framework files ... are NOT copied` comments).
|
|
119
|
+
|
|
120
|
+
To opt into this richer template for a project's *living* `codev/resources/arch.md`, copy it manually:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cp $(node -p 'require.resolve("@cluesmith/codev/skeleton/templates/arch.md")') codev/resources/arch.md
|
|
124
|
+
```
|
|
55
125
|
|
|
56
|
-
|
|
126
|
+
(Or, if developing inside the codev repo itself, simply `cp codev-skeleton/templates/arch.md codev/resources/arch.md` and edit from there.)
|
|
@@ -1,28 +1,66 @@
|
|
|
1
1
|
# Lessons Learned
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Engineering wisdom that applies *across multiple specs*, extracted from review documents during MAINTAIN runs.
|
|
4
|
+
|
|
5
|
+
> **How to read this doc**: Skim by topic section. Each entry is 1–3 sentences and states a general principle. If you need the full story behind a lesson, follow the link to the originating review.
|
|
6
|
+
|
|
7
|
+
## What goes here, what does not
|
|
8
|
+
|
|
9
|
+
This file is a sibling to `codev/resources/arch.md`. They have different purposes:
|
|
10
|
+
|
|
11
|
+
- `arch.md` owns **system shape** — services, transports, mental models, verified-wrong assumptions about *this* system.
|
|
12
|
+
- `lessons-learned.md` owns **durable engineering wisdom** — patterns that apply across specs, projects, and time.
|
|
13
|
+
|
|
14
|
+
When you have a fact that's specific to one feature, it belongs in that feature's review, not here.
|
|
15
|
+
|
|
16
|
+
### Add an entry when
|
|
17
|
+
|
|
18
|
+
- A pattern surfaced in two or more specs/reviews.
|
|
19
|
+
- A failure mode is general enough that future contributors will hit it on unrelated work.
|
|
20
|
+
- A practice was confirmed (the team adopted it after trying alternatives).
|
|
21
|
+
|
|
22
|
+
### Do NOT add an entry when
|
|
23
|
+
|
|
24
|
+
- **Spec-narrow recipes** that only matter inside the originating feature. Those belong in the spec's review document.
|
|
25
|
+
- **Multi-paragraph entries**. If a lesson needs more than 1–3 sentences, it is either two lessons or it is documentation that belongs elsewhere.
|
|
26
|
+
- **Duplicate adjacent entries**. Fold variations of the same lesson into one entry.
|
|
27
|
+
- **Spec-numbered narrative** ("Lesson from #0468:…"). Link to the review if useful; state the lesson itself as a general principle.
|
|
28
|
+
|
|
29
|
+
### Sanity-check checklist
|
|
30
|
+
|
|
31
|
+
Before adding or keeping an entry, run through these:
|
|
32
|
+
|
|
33
|
+
1. Is it cross-applicable beyond the spec that produced it?
|
|
34
|
+
2. Is it terse (1–3 sentences)?
|
|
35
|
+
3. Is the topic section the right home? (If "Architecture (continued)" or spec-numbered, move it.)
|
|
36
|
+
4. Is it a duplicate of an adjacent entry? (If yes, fold them.)
|
|
37
|
+
5. Could the lesson be stated as a general principle, independent of the originating feature?
|
|
38
|
+
|
|
39
|
+
If any answer is "no," either reshape the entry or move it to the originating spec's review.
|
|
40
|
+
|
|
41
|
+
---
|
|
4
42
|
|
|
5
43
|
## Testing
|
|
6
44
|
|
|
7
|
-
<!--
|
|
45
|
+
<!-- Patterns about test isolation, mocking, fixtures, regression coverage. -->
|
|
8
46
|
|
|
9
47
|
## Architecture
|
|
10
48
|
|
|
11
|
-
<!--
|
|
49
|
+
<!-- Patterns about system design, state management, file organization. -->
|
|
12
50
|
|
|
13
51
|
## Process
|
|
14
52
|
|
|
15
|
-
<!--
|
|
53
|
+
<!-- Patterns about protocol execution, consultation, PR workflow. -->
|
|
16
54
|
|
|
17
55
|
## Tooling
|
|
18
56
|
|
|
19
|
-
<!--
|
|
57
|
+
<!-- Patterns about CLI tools, dependencies, build systems. -->
|
|
20
58
|
|
|
21
59
|
## Integration
|
|
22
60
|
|
|
23
|
-
<!--
|
|
61
|
+
<!-- Patterns about external APIs, third-party services, auth. -->
|
|
24
62
|
|
|
25
63
|
---
|
|
26
64
|
|
|
27
65
|
*Generated by MAINTAIN protocol from review documents.*
|
|
28
|
-
*To add lessons: document them in review files, then run MAINTAIN.*
|
|
66
|
+
*To add lessons: document them in review files, then run MAINTAIN with the `update-arch-docs` skill.*
|