Commit d9ef032
docs(optimisation): Cluster 5.1 capsule-readiness audit pilot (5 / 272 modules)
Cluster 5.1 from PHASE-2-PLAN.md is explicitly cleared to run before
Phase 2 formally starts (audit-only, no code change, no Mac-launcher
risk). This is the pilot: methodology + rubric + capability
vocabulary, applied to 5 representative pc2-node/src modules to
validate the approach before sinking days into the full 272-file
audit.
Sections:
1. Methodology — what a "capsule" means for this audit, drawn from
the ElastOS Runtime architecture constraints (capability tokens,
message-passing, no ambient authority, deterministic side-effects).
2. Classification rubric — three classes (A/B/C) on a 0-10 score with
per-violation deduction guidance. Calibrated against the 5 pilot
modules.
3. Capability vocabulary — 14 standardised names for the external
effects a module can have. Future audit batches reuse these names;
new categories added at the end of the table when first needed.
4. Pilot audit — 5 modules spanning the structural spectrum:
- runtime-heartbeat.ts (B, 7/10): schema-versioned but calls
process.exit directly and depends on pc2-node-specific respawner.
- setupPermissions.ts (B, 5/10): OS-specific privileged-command
shell construction (the v1.2.7.11 bug surface).
- OpenAIProvider.ts (A, 9/10): the gold standard. Pure I/O via SDK,
all config DI'd at construction, narrow public interface. Only
blocker is type imports from a sibling provider.
- AgentMemoryManager.ts (A-, 8/10): DI of FilesystemManager + wallet
scoping is exactly the Runtime pattern. Minor blocker: depends on
a concrete class import where an interface would suffice.
- ConnectivityService.ts (C, 2/10): 22+ private fields, setter-
pattern post-construction injection, 6 sibling-service concrete
dependencies. Refactor path requires ~2-3 weeks split into three
stages or, more practically, wait for the Runtime track to
subsume it via capsule replacements.
5. Aggregate observations: 5 top blocker patterns identified, each
appearing in 2+ pilot modules — these become Phase 2 refactor
candidates once the full audit confirms breadth.
6. What's left to audit: 267 files mapped to 9 directories, with
hypotheses to test per subtree (AI is likely A-heavy, boson is
likely C-heavy, etc.). Estimated ~30 hours analyst-time at current
pace, parallelisable across auditors.
7. Recommended next steps: stop after pilot (today), extend in
subtree batches in the May 25-29 window post-Mac-launcher.
Key strategic finding: the AI + storage subtrees of pc2-node already
look close to capsule-shaped (OpenAIProvider scored 9/10,
AgentMemoryManager 8/10). This empirically supports the
AGENTIC-PC2-MONETISATION dual-track strategy claim that AI feature
work in PC2 v1 will translate cleanly to the Runtime; we are NOT
building throw-away patterns in this area.
Connectivity orchestration is at the other extreme (ConnectivityService
2/10) — further significant infrastructure on top of those rails would
entangle new code with the legacy state machine. Consistent with the
mandate's "defer to Runtime track" recommendation for that area.
No product code touched. Pure analysis.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent ffbe9c7 commit d9ef032
1 file changed
Lines changed: 295 additions & 0 deletions
0 commit comments