Skip to content

Commit 7f7cfe4

Browse files
authored
Merge pull request #675 from cluesmith/builder/task-NH8C
[Maintain 0007] Pre-v3.0.0 maintenance
2 parents eaefd35 + 2d4a17f commit 7f7cfe4

6 files changed

Lines changed: 162 additions & 66 deletions

File tree

AGENTS.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,28 @@ To release a new version, tell the AI: `Let's release v1.6.0`. The AI follows th
3636
To test changes locally before publishing to npm:
3737

3838
```bash
39-
# From packages/codev directory:
40-
cd packages/codev
39+
# From the repository root:
4140

42-
# 1. Build and create tarball (Tower stays up during this)
41+
# 1. Build (Tower stays up during this)
4342
pnpm build
44-
pnpm pack
4543

46-
# 2. Install (Tower stays up — running process already loaded old code)
47-
npm install -g ./cluesmith-codev-*.tgz
44+
# 2. Pack both tarballs
45+
pnpm --filter @cluesmith/codev-core pack
46+
pnpm --filter @cluesmith/codev pack
47+
48+
# 3. Install globally (Tower stays up)
49+
pnpm local-install
4850

4951
# 3. Restart (only this step needs downtime)
5052
afx tower stop && afx tower start
5153
```
5254

55+
- `pnpm build` builds core first, then codev (including dashboard)
56+
- `pnpm --filter <package> pack` creates tarballs (run for core and codev separately)
57+
- `pnpm local-install` installs both tarballs in a single `npm install -g` command — separate installs fail because `@cluesmith/codev-core` isn't on the public npm registry
5358
- Install while Tower is running — it doesn't affect the running process
5459
- Do NOT stop Tower before installing — unnecessary downtime
55-
- Do NOT delete the tarball — keep it for debugging if restart fails
60+
- Do NOT delete the tarballs — keep them for debugging if restart fails
5661
- Do NOT build between stop and start
5762
- Do NOT use `npm link` or `pnpm link` — it breaks global installs
5863

codev/maintain/0007.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Maintenance Run 0007
2+
3+
**Date**: 2026-04-17
4+
**Base Commit**: 47cb2c86 (Maintenance Run 0006 merge)
5+
**Current HEAD**: eaefd35b
6+
**Scope**: Pre-release maintenance for v3.0.0
7+
**Commits since last run**: 1751 (261 merges)
8+
9+
## Changes Since Last Run
10+
11+
Major features merged since run 0006 (partial list):
12+
13+
- **VS Code extension** (Spec 0602): New `packages/vscode/` thin client over Tower API — Pseudoterminal↔WebSocket terminals, sidebar TreeViews, auto-Tower startup, SecretStorage auth
14+
- **codev-core package** (Spec 0602): Shared runtime extracted from codev — `TowerClient`, `auth`, `workspace`, `EscapeBuffer` — published as `@cluesmith/codev-core`
15+
- **TICK protocol removed** (Spec 653): Replaced by multi-PR workflow in SPIR/ASPIR; verify phase added; worktree reused across multiple PRs
16+
- **Hermes consult backend** (Spec 671): Optional 4th consultation model; kept off by default
17+
- **afx rename** (Spec 647): `af``afx` across CLI, bin shims, and docs
18+
- **Configuration overhaul** (Spec 618): Systematic config reorganization
19+
- **Terminal scroll consolidation** (Spec 627): `ScrollController` state machine replaces three competing mechanisms
20+
- **Team standalone CLI** (Spec 599): `team` extracted from `afx team`
21+
- **pnpm monorepo migration** (PR #669): Yarn/npm workspaces → pnpm 10
22+
- **MAINTAIN protocol simplification** (current branch base): Reduced from 4 phases to 2
23+
24+
## What Was Done
25+
26+
### Dead Code / Dependencies Removed
27+
28+
| Item | Location | Why |
29+
|------|----------|-----|
30+
| `http-proxy` | `packages/codev/package.json` | Zero imports in `src/`; leftover from pre-Tower dashboard proxy. Flagged in run 0006 but not removed then. |
31+
| `@types/http-proxy` | `packages/codev/package.json` | Types for the now-unused `http-proxy` package. |
32+
33+
Other ts-prune/depcheck findings were investigated but retained:
34+
35+
- `@vitest/coverage-v8` — dynamically loaded by vitest config at `vitest.config.ts:30` (`provider: 'v8'`), depcheck can't detect this.
36+
- `@xterm/xterm` — was flagged as transitively resolved; per Gemini's 3-way review, pinned explicitly in `devDependencies` (`^5.5.0`) since the test file imports it directly. Relying on a transitive dashboard dep was fragile.
37+
- `state.ts` util/annotation/architect exports — used in test files; part of public state API surface.
38+
- `forge.ts`, `github.ts`, `templates.ts`, `scaffold.ts`, `skeleton.ts`, `team.ts` unused exports — all used by their sibling test files. Conservative: keep public API stable.
39+
- `cli.ts:378 run()` — exported for bin shims (`afx.js`, `consult.js`).
40+
- `terminal/index.ts` re-exports — barrel file for external consumers; not dead.
41+
42+
### Documentation Updated
43+
44+
**`codev/resources/arch.md`**:
45+
- Refreshed `afx` commands tree: added `spawn-worktree`, `spawn-roles`, `attach`, `architect`, `shell`, `tower`, `tower-cloud`, `cron`, `team`, `team-update`, `db`; removed non-existent `util.ts`.
46+
- Refreshed `bin/` tree: added `af.js` (deprecation shim) and `generate-image.js`.
47+
- Refreshed `codev/protocols/` tree: added `aspir`, `air`, `bugfix`, `release`, `spike`, and `protocol-schema.json` (were missing).
48+
- Corrected `spir/` subtree: removed nonexistent `manifest.yaml`; added actual files (`protocol.json`, `builder-prompt.md`, `prompts/`, `consult-types/`).
49+
- Refreshed `codev-skeleton/protocols/` subtree: added `aspir`, `air`, `bugfix`, `spike` (was stale — only listed `spir`, `experiment`, `maintain`).
50+
- Updated version footer: `v2.0.0-rc.54``v3.0.0-rc.9`; date bumped to 2026-04-17.
51+
52+
**`codev/resources/lessons-learned.md`**:
53+
- Added 3 lessons from Spec 653 (builder handling / TICK removal) at the end of the **Critical (Prevent Major Failures)** section: start from structural insight, full-repo grep for protocol removal, single verify-pass consultation cadence.
54+
- Updated footer date.
55+
56+
**`AGENTS.md`**:
57+
- Synced with `CLAUDE.md` — local-install instructions updated to pnpm 10 monorepo flow (`pnpm local-install` targets both `codev-core` and `codev` tarballs in one `npm install -g` call). Prior AGENTS.md copy still referenced the pre-monorepo `cd packages/codev && pnpm pack` flow.
58+
- `diff CLAUDE.md AGENTS.md` is now clean.
59+
60+
### Documentation Changes Log
61+
62+
| Document | Section | Action | Reason |
63+
|----------|---------|--------|--------|
64+
| arch.md | afx commands tree | UPDATED | Tree was missing 10 commands added since run 0006; listed obsolete `util.ts` |
65+
| arch.md | bin scripts tree | UPDATED | Missing `af.js` deprecation shim and `generate-image.js` |
66+
| arch.md | codev protocols tree | UPDATED | Missing `aspir`, `air`, `bugfix`, `release`, `spike` |
67+
| arch.md | version footer | UPDATED | Was stamped at v2.0.0-rc.54; now v3.0.0-rc.9 pre-release |
68+
| lessons-learned.md | Critical | APPENDED | 3 entries from Spec 653 review |
69+
| lessons-learned.md | footer | UPDATED | Run date 2026-04-17 |
70+
| AGENTS.md | Local Build Testing | REWRITTEN | OBSOLETE — pre-pnpm-monorepo; drifted from CLAUDE.md during PR #669 |
71+
72+
## Verification
73+
74+
- `pnpm install` → clean
75+
- `pnpm build` → passes (codev-core, codev, dashboard all built)
76+
- `pnpm --filter @cluesmith/codev test`**122 test files, 2462 passed, 13 skipped**
77+
78+
## Deferred
79+
80+
- **`@vitest/coverage-v8` depcheck false positive** — could add explicit import to silence depcheck, but the `provider: 'v8'` string is the idiomatic vitest pattern. Not worth special-casing.
81+
- **`@xterm/xterm` missing-dep warning** — would need to add as explicit dev dep in `packages/codev` or refactor the test to import through dashboard. Not runtime-critical.
82+
- **arch.md full rewrite**`arch.md` is 1,776 lines; ~90% still accurate. A full rewrite is out of scope for a pre-release MAINTAIN pass.
83+
- **`ts-prune` noise from barrel files**`terminal/index.ts` re-exports would need per-file annotation (`// ts-prune-ignore-next`) or a config file to silence. Low value.
84+
85+
## Consultation Log
86+
87+
3-way review run before opening PR (prompt at `/tmp/maintain-0007-consult-prompt.md`):
88+
89+
| Reviewer | Verdict | Key findings |
90+
|----------|---------|--------------|
91+
| **Gemini** | REQUEST_CHANGES | Missed `protocol-schema.json` in tree; `codev-skeleton/protocols/` subtree still stale; lessons placed under wrong section heading (ran report said Critical, actually appended to end of file); push back on deferring `@xterm/xterm` — one-line fix, just add the devDep. |
92+
| **Codex** | APPROVE_WITH_COMMENTS | `spir/` subtree listed nonexistent `manifest.yaml`; `codev-skeleton/protocols/` still stale (same as Gemini); noted CLI examples elsewhere in arch.md (`afx util`, `afx tunnel`, `afx ports`) are stale but out of scope. |
93+
| **Claude** | APPROVE_WITH_COMMENTS | All three trees and dep removal verified against filesystem. Noted pre-existing duplicate step numbering (`# 3`) in local-install section of CLAUDE.md/AGENTS.md (not introduced here). |
94+
95+
### Actions taken in response
96+
97+
- Added `protocol-schema.json` to `codev/protocols/` tree (Gemini)
98+
- Fixed `spir/` subtree to match actual files (Codex)
99+
- Refreshed `codev-skeleton/protocols/` subtree (Gemini + Codex)
100+
- Moved Spec 653 lessons into the **Critical** section (Gemini)
101+
- Added `@xterm/xterm` to `packages/codev` devDependencies (Gemini)
102+
- Not addressed: the stale CLI examples elsewhere in arch.md — Codex flagged these as out-of-scope, and fixing them well would require a broader CLI audit. Deferred to a future MAINTAIN pass.
103+
- Not addressed: duplicate `# 3` step numbering in CLAUDE.md/AGENTS.md. Pre-existing on `main`; belongs in a separate doc tweak.
104+
105+
## Summary
106+
107+
First run on the simplified (2-phase) MAINTAIN protocol. The dependency cleanup caught up on the one un-acted item from run 0006's findings (`http-proxy`). Documentation sync was the bulk of the work: arch.md's directory trees had drifted significantly over 1,751 commits (VS Code extension, codev-core split, pnpm migration, afx rename, TICK removal). Everything builds and all unit tests pass against the refreshed tree.

codev/resources/arch.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,16 +1046,26 @@ codev/ # Project root (pnpm monorepo)
10461046
│ │ │ ├── state.ts # SQLite state management
10471047
│ │ │ ├── types.ts # Type definitions
10481048
│ │ │ ├── commands/ # afx CLI commands
1049-
│ │ │ │ ├── start.ts # Start architect dashboard
1049+
│ │ │ │ ├── start.ts # Start Tower workspace
10501050
│ │ │ │ ├── stop.ts # Stop all processes
10511051
│ │ │ │ ├── spawn.ts # Spawn builder
1052+
│ │ │ │ ├── spawn-worktree.ts # Create git worktree for spawn
1053+
│ │ │ │ ├── spawn-roles.ts # Role prompt injection for spawn
10521054
│ │ │ │ ├── status.ts # Show status
10531055
│ │ │ │ ├── cleanup.ts # Clean up builder
1054-
│ │ │ │ ├── util.ts # Utility shell
10551056
│ │ │ │ ├── open.ts # File annotation viewer
10561057
│ │ │ │ ├── send.ts # Send message to builder
1057-
│ │ │ │ ├── rename.ts # Rename builder/util
1058-
│ │ │ │ └── bench.ts # Consultation benchmarking (afx bench)
1058+
│ │ │ │ ├── rename.ts # Rename builder
1059+
│ │ │ │ ├── bench.ts # Consultation benchmarking (afx bench)
1060+
│ │ │ │ ├── attach.ts # Attach directly to shellper session
1061+
│ │ │ │ ├── architect.ts # Architect session management
1062+
│ │ │ │ ├── shell.ts # Shell session management
1063+
│ │ │ │ ├── tower.ts # Tower daemon control (start/stop)
1064+
│ │ │ │ ├── tower-cloud.ts # Cloud tunnel management
1065+
│ │ │ │ ├── cron.ts # Scheduled task management
1066+
│ │ │ │ ├── team.ts # Team operations (deprecated; use `team` CLI)
1067+
│ │ │ │ ├── team-update.ts # Team activity aggregation
1068+
│ │ │ │ └── db.ts # SQLite database commands
10591069
│ │ │ ├── servers/ # Web servers (Spec 0105 decomposition)
10601070
│ │ │ │ ├── tower-server.ts # Orchestrator: HTTP/WS server creation, subsystem init, shutdown
10611071
│ │ │ │ ├── tower-routes.ts # HTTP route handlers (~30 routes)
@@ -1078,9 +1088,11 @@ codev/ # Project root (pnpm monorepo)
10781088
│ ├── bin/ # CLI entry points
10791089
│ │ ├── codev.js # codev command
10801090
│ │ ├── afx.js # afx command (af.js deprecated, redirects)
1091+
│ │ ├── af.js # Deprecated; redirects to afx
10811092
│ │ ├── consult.js # consult command
10821093
│ │ ├── team.js # team command
1083-
│ │ └── porch.js # porch command
1094+
│ │ ├── porch.js # porch command
1095+
│ │ └── generate-image.js # generate-image command
10841096
│ ├── dashboard-dist/ # Dashboard build output (copied from packages/dashboard/dist)
10851097
│ ├── skeleton/ # Embedded codev-skeleton (built)
10861098
│ ├── templates/ # HTML templates
@@ -1100,10 +1112,19 @@ codev/ # Project root (pnpm monorepo)
11001112
│ ├── protocols/ # Working copies for development
11011113
│ │ ├── spir/ # Multi-phase with consultation
11021114
│ │ │ ├── protocol.md
1115+
│ │ │ ├── protocol.json
1116+
│ │ │ ├── builder-prompt.md
11031117
│ │ │ ├── templates/
1104-
│ │ │ └── manifest.yaml
1118+
│ │ │ ├── prompts/
1119+
│ │ │ └── consult-types/
1120+
│ │ ├── aspir/ # Autonomous SPIR (no human gates)
1121+
│ │ ├── air/ # Autonomous Implement & Review
1122+
│ │ ├── bugfix/ # GitHub Issue-driven fixes
11051123
│ │ ├── experiment/ # Disciplined experimentation
1106-
│ │ └── maintain/ # Codebase maintenance
1124+
│ │ ├── release/ # Version release procedure
1125+
│ │ ├── spike/ # Time-boxed research
1126+
│ │ ├── maintain/ # Codebase maintenance
1127+
│ │ └── protocol-schema.json # JSON schema for protocol.json files
11071128
│ ├── specs/ # Our feature specifications
11081129
│ ├── plans/ # Our implementation plans
11091130
│ ├── reviews/ # Our lessons learned
@@ -1118,7 +1139,11 @@ codev/ # Project root (pnpm monorepo)
11181139
│ ├── templates/ # Document templates (CLAUDE.md, arch.md, etc.)
11191140
│ ├── protocols/ # Protocol definitions
11201141
│ │ ├── spir/
1142+
│ │ ├── aspir/
1143+
│ │ ├── air/
1144+
│ │ ├── bugfix/
11211145
│ │ ├── experiment/
1146+
│ │ ├── spike/
11221147
│ │ └── maintain/
11231148
│ ├── specs/ # Empty (placeholder)
11241149
│ ├── plans/ # Empty (placeholder)
@@ -1771,6 +1796,6 @@ See [MAINTAIN protocol](../protocols/maintain/protocol.md) for codebase hygiene
17711796

17721797
---
17731798

1774-
**Last Updated**: 2026-02-18
1775-
**Version**: v2.0.0-rc.54 (Pre-release)
1776-
**Changes**: Refinement round 4/4 -- final fresh-eyes pass. See CHANGELOG.md for version history.
1799+
**Last Updated**: 2026-04-17
1800+
**Version**: v3.0.0-rc.9 (Pre-release)
1801+
**Changes**: Pre-v3.0.0 MAINTAIN run (0007): directory tree refresh, protocol list update, removed unused http-proxy dependency. See CHANGELOG.md for version history.

codev/resources/lessons-learned.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Generalizable wisdom extracted from review documents, ordered by impact. Updated
3838
- [From 0324] `detached: true` and `child.unref()` are necessary but not sufficient for process independence -- any pipe-based stdio (e.g., `stdio: ['ignore', 'pipe', 'pipe']`) creates a lifecycle dependency between parent and child processes. When the parent exits, the broken pipe triggers unhandled EPIPE errors in the child. Use file FDs or `'ignore'` for truly independent daemon children.
3939
- [From bugfix-274] Startup ordering matters when multiple subsystems share resources (Shellper sockets). Initialization order creates implicit synchronization -- calling `initInstances()` before `reconcileTerminalSessions()` allowed dashboard polls to race with reconciliation. Document ordering constraints in comments.
4040
- [From bugfix-274] Defense in depth for race conditions: the startup reorder closes the primary race path, but the `_reconciling` guard provides a safety net for code paths that bypass the primary fix (e.g., direct `/project/.../api/state` requests bypassing `getInstances()`).
41+
- [From 653] Start from the structural insight, not the feature list. The first three spec drafts built elaborate gate-ceremony machinery (checkpoint PRs, feedback commands, verify notes) that was all eliminated once the core insight — break the 1:1 builder↔PR assumption — was identified. When a spec feels bloated, look for the one structural change that makes the ceremony unnecessary.
42+
- [From 653] Protocol removal requires full-repo grep, not targeted searches. Removing a protocol touches ~50 files across source, docs, templates, skills, tests, and CLI help text. Scoped searches miss skeleton templates, test fixtures, and user-facing help strings. Run `rg` across the entire repo and verify zero hits before committing.
43+
- [From 653] Single verify pass + rebuttal is the right consultation cadence. Multi-iteration consult loops (running `consult` manually after each fix) violate `max_iterations=1` and add little marginal value over one rigorous verify pass followed by rebuttals.
4144

4245
## Security
4346

@@ -364,5 +367,5 @@ Generalizable wisdom extracted from review documents, ordered by impact. Updated
364367

365368
---
366369

367-
*Last updated: 2026-03-18 (Spec 627 — terminal scroll management consolidation)*
370+
*Last updated: 2026-04-17 (Maintenance run 0007 — v3.0.0 pre-release)*
368371
*Source: codev/reviews/*

packages/codev/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@
4141
"@anthropic-ai/claude-agent-sdk": "^0.2.41",
4242
"@google/genai": "^1.0.0",
4343
"@openai/codex-sdk": "^0.101.0",
44-
"@types/http-proxy": "^1.17.17",
4544
"better-sqlite3": "^12.5.0",
4645
"chalk": "^5.3.0",
4746
"commander": "^12.1.0",
4847
"glob": "^11.0.0",
49-
"http-proxy": "^1.18.1",
5048
"js-yaml": "^4.1.0",
5149
"node-pty": "^1.1.0",
5250
"open": "^10.1.0",
@@ -57,6 +55,7 @@
5755
"@cluesmith/codev-dashboard": "workspace:*",
5856
"@cluesmith/codev-types": "workspace:*",
5957
"@playwright/test": "^1.58.0",
58+
"@xterm/xterm": "^5.5.0",
6059
"@types/better-sqlite3": "^7.6.13",
6160
"@types/js-yaml": "^4.0.9",
6261
"@types/node": "^22.10.1",

0 commit comments

Comments
 (0)