|
| 1 | +# Phase 1 Roadmap |
| 2 | + |
| 3 | +## Scope |
| 4 | + |
| 5 | +Phase 1 hardens the current single-host beta so it can be distributed to subsidiary CTO teams as a controlled enterprise beta. This phase does not introduce the full control-plane and worker split yet. It makes the existing runtime governable, testable, and easier to operate. |
| 6 | + |
| 7 | +## Success Criteria |
| 8 | + |
| 9 | +- Core runtime contracts are type-safe and documented. |
| 10 | +- Dangerous actions require explicit approval and produce audit events. |
| 11 | +- Health, logs, and smoke tests are machine-readable and usable in operations. |
| 12 | +- A new subsidiary team can install and validate the bot with a repeatable checklist. |
| 13 | + |
| 14 | +## Workstreams |
| 15 | + |
| 16 | +### 1. TypeScript Migration For Core Runtime |
| 17 | + |
| 18 | +Scope: |
| 19 | + |
| 20 | +- Migrate `src/config.js` |
| 21 | +- Migrate `src/orchestrator/router.js` |
| 22 | +- Migrate `src/orchestrator/skillRegistry.js` |
| 23 | +- Migrate `src/orchestrator/mcpClient.js` |
| 24 | +- Migrate `src/runner/ptyManager.js` |
| 25 | +- Migrate `src/runner/shellManager.js` |
| 26 | + |
| 27 | +Deliverables: |
| 28 | + |
| 29 | +- `tsconfig.json` |
| 30 | +- build and typecheck commands |
| 31 | +- stable interfaces for config, skill contracts, runner sessions, and runtime state |
| 32 | + |
| 33 | +Acceptance: |
| 34 | + |
| 35 | +- `npm run typecheck` passes |
| 36 | +- existing tests still pass |
| 37 | +- no runtime behavior regression in `/status`, `/repo`, `/mcp`, `/gh`, `/sh` |
| 38 | + |
| 39 | +### 2. Audit Event Model |
| 40 | + |
| 41 | +Scope: |
| 42 | + |
| 43 | +- Define a structured event schema for operator actions and bot decisions. |
| 44 | +- Capture user identity, chat id, project, command, worker host, result, and timestamp. |
| 45 | + |
| 46 | +Deliverables: |
| 47 | + |
| 48 | +- audit event schema document |
| 49 | +- append-only local event sink for beta |
| 50 | +- hooks in Telegram handlers, skill execution, shell execution, and restart flow |
| 51 | + |
| 52 | +Acceptance: |
| 53 | + |
| 54 | +- every privileged action emits an event |
| 55 | +- audit records can be exported as JSON lines |
| 56 | + |
| 57 | +### 3. Approval Gates For Dangerous Actions |
| 58 | + |
| 59 | +Scope: |
| 60 | + |
| 61 | +- Add an approval state machine for write-capable shell actions |
| 62 | +- Add approval for `git push`, repo creation, and other GitHub write actions |
| 63 | + |
| 64 | +Deliverables: |
| 65 | + |
| 66 | +- approval command flow |
| 67 | +- pending approval state storage |
| 68 | +- localized operator-facing prompts |
| 69 | + |
| 70 | +Acceptance: |
| 71 | + |
| 72 | +- dangerous actions cannot execute without explicit approval |
| 73 | +- approval and denial both create audit events |
| 74 | + |
| 75 | +### 4. Structured Logging And Health Output |
| 76 | + |
| 77 | +Scope: |
| 78 | + |
| 79 | +- Replace ad hoc console output with structured logs |
| 80 | +- Add machine-readable health output for automation |
| 81 | + |
| 82 | +Deliverables: |
| 83 | + |
| 84 | +- JSON log mode |
| 85 | +- healthcheck `--json` output |
| 86 | +- operator-visible startup summary |
| 87 | + |
| 88 | +Acceptance: |
| 89 | + |
| 90 | +- logs can be ingested by PM2 or external log collectors |
| 91 | +- healthcheck can be parsed by CI and supervisor tooling |
| 92 | + |
| 93 | +### 5. Telegram Regression Coverage |
| 94 | + |
| 95 | +Scope: |
| 96 | + |
| 97 | +- Extend beyond `getMe` smoke checks |
| 98 | +- Validate critical Telegram command paths against a real bot |
| 99 | + |
| 100 | +Deliverables: |
| 101 | + |
| 102 | +- scripted regression checks for `/status`, `/repo`, `/language`, `/verbose`, `/mcp list` |
| 103 | +- operator runbook for live regression |
| 104 | + |
| 105 | +Acceptance: |
| 106 | + |
| 107 | +- regression script can run in a controlled staging bot environment |
| 108 | +- failures are visible in CI or release gating |
| 109 | + |
| 110 | +### 6. Subsidiary Deployment Pack |
| 111 | + |
| 112 | +Scope: |
| 113 | + |
| 114 | +- Make first-time installation repeatable for subsidiary CTO teams |
| 115 | + |
| 116 | +Deliverables: |
| 117 | + |
| 118 | +- environment checklist |
| 119 | +- service account guidance |
| 120 | +- directory isolation requirements |
| 121 | +- token and secret handling guide |
| 122 | +- PM2 deployment example per host |
| 123 | + |
| 124 | +Acceptance: |
| 125 | + |
| 126 | +- a new team can deploy from docs without direct maintainer intervention |
| 127 | + |
| 128 | +## Recommended Execution Order |
| 129 | + |
| 130 | +1. TypeScript migration for `config`, `router`, and `skillRegistry` |
| 131 | +2. Audit event schema and append-only sink |
| 132 | +3. Approval flow for dangerous actions |
| 133 | +4. Structured logging and machine-readable health output |
| 134 | +5. Telegram regression automation |
| 135 | +6. Subsidiary deployment pack finalization |
| 136 | + |
| 137 | +## Risks |
| 138 | + |
| 139 | +- Migrating runtime modules to TypeScript without preserving behavior will create operational regressions. |
| 140 | +- Approval flow added too late leaves write actions under-governed. |
| 141 | +- Regression checks that depend on a personal bot token are not suitable for shared enterprise CI. |
| 142 | +- Audit logs without a stable schema will become unusable once the control-plane split starts. |
| 143 | + |
| 144 | +## Out Of Scope |
| 145 | + |
| 146 | +- Multi-worker control plane |
| 147 | +- SSO/OIDC and enterprise RBAC |
| 148 | +- centralized database-backed audit store |
| 149 | +- full tenant isolation |
| 150 | +- webhook-based high-availability Telegram ingress |
| 151 | + |
| 152 | +These begin in Phase 2. |
0 commit comments