holo-codex 0.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.
Files changed (149) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/CONTRIBUTING.md +54 -0
  3. package/LICENSE +21 -0
  4. package/README.md +215 -0
  5. package/README.zh-CN.md +215 -0
  6. package/SECURITY.md +39 -0
  7. package/assets/brand/README.md +35 -0
  8. package/assets/brand/holo-codex-icon.svg +28 -0
  9. package/assets/brand/holo-codex-lockup.svg +49 -0
  10. package/assets/brand/holo-codex-mark.svg +33 -0
  11. package/assets/brand/holo-codex-plugin-card.png +0 -0
  12. package/assets/brand/holo-codex-plugin-card.svg +81 -0
  13. package/assets/brand/holo-codex-readme-hero.png +0 -0
  14. package/assets/brand/holo-codex-readme-hero.svg +140 -0
  15. package/assets/brand/holo-codex-social-preview.png +0 -0
  16. package/assets/brand/holo-codex-social-preview.svg +130 -0
  17. package/assets/brand/holo-codex-wordmark-options.svg +52 -0
  18. package/docs/checklists/agent-loop-first-delivery-audit.md +129 -0
  19. package/docs/examples/generic-loop-repo-hygiene.md +168 -0
  20. package/docs/install.md +190 -0
  21. package/docs/local-release-readiness.md +206 -0
  22. package/docs/release-checklist.md +144 -0
  23. package/docs/self-bootstrap.md +150 -0
  24. package/docs/trust-and-safety.md +45 -0
  25. package/package.json +83 -0
  26. package/plugins/autonomous-pr-loop/.codex-plugin/plugin.json +17 -0
  27. package/plugins/autonomous-pr-loop/.mcp.json +13 -0
  28. package/plugins/autonomous-pr-loop/bin/agent-loop.mjs +31 -0
  29. package/plugins/autonomous-pr-loop/core/artifacts.ts +164 -0
  30. package/plugins/autonomous-pr-loop/core/autonomy-policy.ts +206 -0
  31. package/plugins/autonomous-pr-loop/core/ci.ts +131 -0
  32. package/plugins/autonomous-pr-loop/core/cli-i18n.ts +123 -0
  33. package/plugins/autonomous-pr-loop/core/cli.ts +1413 -0
  34. package/plugins/autonomous-pr-loop/core/command-runner.ts +446 -0
  35. package/plugins/autonomous-pr-loop/core/command.ts +47 -0
  36. package/plugins/autonomous-pr-loop/core/config-editor.ts +140 -0
  37. package/plugins/autonomous-pr-loop/core/config.ts +293 -0
  38. package/plugins/autonomous-pr-loop/core/controller-host.ts +19 -0
  39. package/plugins/autonomous-pr-loop/core/dashboard-server.ts +536 -0
  40. package/plugins/autonomous-pr-loop/core/delivery-work-item.ts +217 -0
  41. package/plugins/autonomous-pr-loop/core/doctor.ts +335 -0
  42. package/plugins/autonomous-pr-loop/core/errors.ts +82 -0
  43. package/plugins/autonomous-pr-loop/core/gate-recovery.ts +176 -0
  44. package/plugins/autonomous-pr-loop/core/gates.ts +26 -0
  45. package/plugins/autonomous-pr-loop/core/generic-lifecycle.ts +399 -0
  46. package/plugins/autonomous-pr-loop/core/git.ts +213 -0
  47. package/plugins/autonomous-pr-loop/core/github.ts +269 -0
  48. package/plugins/autonomous-pr-loop/core/gitnexus.ts +90 -0
  49. package/plugins/autonomous-pr-loop/core/happy.ts +42 -0
  50. package/plugins/autonomous-pr-loop/core/hook-capture.ts +115 -0
  51. package/plugins/autonomous-pr-loop/core/hook-events.ts +22 -0
  52. package/plugins/autonomous-pr-loop/core/hook-installation.ts +85 -0
  53. package/plugins/autonomous-pr-loop/core/hook-observer.ts +84 -0
  54. package/plugins/autonomous-pr-loop/core/hook-policy.ts +423 -0
  55. package/plugins/autonomous-pr-loop/core/hook-router.ts +452 -0
  56. package/plugins/autonomous-pr-loop/core/index.ts +32 -0
  57. package/plugins/autonomous-pr-loop/core/local-install.ts +778 -0
  58. package/plugins/autonomous-pr-loop/core/locale.ts +60 -0
  59. package/plugins/autonomous-pr-loop/core/loop-shapes.ts +190 -0
  60. package/plugins/autonomous-pr-loop/core/mcp-controller.ts +1479 -0
  61. package/plugins/autonomous-pr-loop/core/notification-feed.ts +263 -0
  62. package/plugins/autonomous-pr-loop/core/plan-parser.ts +206 -0
  63. package/plugins/autonomous-pr-loop/core/plugin-paths.ts +32 -0
  64. package/plugins/autonomous-pr-loop/core/policy.ts +65 -0
  65. package/plugins/autonomous-pr-loop/core/pr-lifecycle.ts +464 -0
  66. package/plugins/autonomous-pr-loop/core/pr-selector.ts +284 -0
  67. package/plugins/autonomous-pr-loop/core/profiles.ts +439 -0
  68. package/plugins/autonomous-pr-loop/core/redaction.ts +17 -0
  69. package/plugins/autonomous-pr-loop/core/repo-root.ts +22 -0
  70. package/plugins/autonomous-pr-loop/core/review-comments.ts +77 -0
  71. package/plugins/autonomous-pr-loop/core/scope-guard.ts +179 -0
  72. package/plugins/autonomous-pr-loop/core/state-machine.ts +828 -0
  73. package/plugins/autonomous-pr-loop/core/state-types.ts +130 -0
  74. package/plugins/autonomous-pr-loop/core/storage.ts +2527 -0
  75. package/plugins/autonomous-pr-loop/core/types.ts +567 -0
  76. package/plugins/autonomous-pr-loop/core/worker-events.ts +412 -0
  77. package/plugins/autonomous-pr-loop/core/worker-policy.ts +72 -0
  78. package/plugins/autonomous-pr-loop/core/worker-prompts.ts +182 -0
  79. package/plugins/autonomous-pr-loop/core/worker.ts +809 -0
  80. package/plugins/autonomous-pr-loop/core/workflow-board.ts +1515 -0
  81. package/plugins/autonomous-pr-loop/hooks/dist/permission-request.js +2462 -0
  82. package/plugins/autonomous-pr-loop/hooks/dist/post-compact.js +2462 -0
  83. package/plugins/autonomous-pr-loop/hooks/dist/post-tool-use.js +2462 -0
  84. package/plugins/autonomous-pr-loop/hooks/dist/pre-compact.js +2462 -0
  85. package/plugins/autonomous-pr-loop/hooks/dist/pre-tool-use.js +3460 -0
  86. package/plugins/autonomous-pr-loop/hooks/dist/session-start.js +2462 -0
  87. package/plugins/autonomous-pr-loop/hooks/dist/stop.js +2462 -0
  88. package/plugins/autonomous-pr-loop/hooks/dist/user-prompt-submit.js +2462 -0
  89. package/plugins/autonomous-pr-loop/hooks/hooks.json +106 -0
  90. package/plugins/autonomous-pr-loop/hooks/observe-runner.ts +25 -0
  91. package/plugins/autonomous-pr-loop/hooks/permission-request.ts +4 -0
  92. package/plugins/autonomous-pr-loop/hooks/post-compact.ts +4 -0
  93. package/plugins/autonomous-pr-loop/hooks/post-tool-use.ts +4 -0
  94. package/plugins/autonomous-pr-loop/hooks/pre-compact.ts +4 -0
  95. package/plugins/autonomous-pr-loop/hooks/pre-tool-use.ts +44 -0
  96. package/plugins/autonomous-pr-loop/hooks/session-start.ts +4 -0
  97. package/plugins/autonomous-pr-loop/hooks/stop.ts +4 -0
  98. package/plugins/autonomous-pr-loop/hooks/user-prompt-submit.ts +4 -0
  99. package/plugins/autonomous-pr-loop/mcp-server/src/index.ts +87 -0
  100. package/plugins/autonomous-pr-loop/mcp-server/src/tools.ts +205 -0
  101. package/plugins/autonomous-pr-loop/package.json +9 -0
  102. package/plugins/autonomous-pr-loop/schemas/config.schema.json +74 -0
  103. package/plugins/autonomous-pr-loop/schemas/marketplace.schema.json +46 -0
  104. package/plugins/autonomous-pr-loop/schemas/plugin.schema.json +32 -0
  105. package/plugins/autonomous-pr-loop/schemas/state.schema.json +19 -0
  106. package/plugins/autonomous-pr-loop/schemas/worker-event.schema.json +19 -0
  107. package/plugins/autonomous-pr-loop/schemas/worker-result.schema.json +58 -0
  108. package/plugins/autonomous-pr-loop/scripts/agent-loop.ts +44 -0
  109. package/plugins/autonomous-pr-loop/skills/autonomous-pr-loop/SKILL.md +26 -0
  110. package/plugins/autonomous-pr-loop/skills/autonomous-pr-loop/agents/openai.yaml +6 -0
  111. package/plugins/autonomous-pr-loop/ui/index.html +26 -0
  112. package/plugins/autonomous-pr-loop/ui/public/favicon.svg +7 -0
  113. package/plugins/autonomous-pr-loop/ui/src/api.ts +639 -0
  114. package/plugins/autonomous-pr-loop/ui/src/app.tsx +238 -0
  115. package/plugins/autonomous-pr-loop/ui/src/components/ActivityBadge.tsx +31 -0
  116. package/plugins/autonomous-pr-loop/ui/src/components/BrandMark.tsx +36 -0
  117. package/plugins/autonomous-pr-loop/ui/src/components/Collapsible.tsx +6 -0
  118. package/plugins/autonomous-pr-loop/ui/src/components/CommandPreview.tsx +15 -0
  119. package/plugins/autonomous-pr-loop/ui/src/components/ConfigEditor.tsx +389 -0
  120. package/plugins/autonomous-pr-loop/ui/src/components/EmptyState.tsx +10 -0
  121. package/plugins/autonomous-pr-loop/ui/src/components/ErrorState.tsx +12 -0
  122. package/plugins/autonomous-pr-loop/ui/src/components/List.tsx +7 -0
  123. package/plugins/autonomous-pr-loop/ui/src/components/MetricRow.tsx +6 -0
  124. package/plugins/autonomous-pr-loop/ui/src/components/ResponsiveTable.tsx +65 -0
  125. package/plugins/autonomous-pr-loop/ui/src/components/RiskBadge.tsx +10 -0
  126. package/plugins/autonomous-pr-loop/ui/src/components/StatusBadge.tsx +29 -0
  127. package/plugins/autonomous-pr-loop/ui/src/components/TopMetric.tsx +10 -0
  128. package/plugins/autonomous-pr-loop/ui/src/fixtures.ts +1152 -0
  129. package/plugins/autonomous-pr-loop/ui/src/i18n.ts +1105 -0
  130. package/plugins/autonomous-pr-loop/ui/src/main.tsx +14 -0
  131. package/plugins/autonomous-pr-loop/ui/src/pages/CommandCenter.tsx +470 -0
  132. package/plugins/autonomous-pr-loop/ui/src/pages/CommandCenterParts.tsx +276 -0
  133. package/plugins/autonomous-pr-loop/ui/src/pages/agent-timeline/AgentTimelineView.tsx +73 -0
  134. package/plugins/autonomous-pr-loop/ui/src/pages/artifact-viewer/ArtifactViewer.tsx +44 -0
  135. package/plugins/autonomous-pr-loop/ui/src/pages/dry-run-preview/DryRunPreview.tsx +66 -0
  136. package/plugins/autonomous-pr-loop/ui/src/pages/event-ledger/EventLedger.tsx +17 -0
  137. package/plugins/autonomous-pr-loop/ui/src/pages/gate-center/GateCenter.tsx +34 -0
  138. package/plugins/autonomous-pr-loop/ui/src/pages/mission-control/MissionControl.tsx +104 -0
  139. package/plugins/autonomous-pr-loop/ui/src/pages/mission-control/WorkflowBoard.tsx +577 -0
  140. package/plugins/autonomous-pr-loop/ui/src/pages/notifications/NotificationsView.tsx +30 -0
  141. package/plugins/autonomous-pr-loop/ui/src/pages/plan-navigator/PlanNavigator.tsx +19 -0
  142. package/plugins/autonomous-pr-loop/ui/src/pages/policy-config/PolicyConfig.tsx +22 -0
  143. package/plugins/autonomous-pr-loop/ui/src/pages/pr-inbox/PrInbox.tsx +26 -0
  144. package/plugins/autonomous-pr-loop/ui/src/pages/recovery-center/RecoveryCenter.tsx +125 -0
  145. package/plugins/autonomous-pr-loop/ui/src/pages/scope-guard/ScopeGuard.tsx +16 -0
  146. package/plugins/autonomous-pr-loop/ui/src/pages/worker-runs/WorkerRuns.tsx +39 -0
  147. package/plugins/autonomous-pr-loop/ui/src/styles.css +2673 -0
  148. package/plugins/autonomous-pr-loop/ui/src/theme.ts +57 -0
  149. package/tsconfig.json +18 -0
@@ -0,0 +1,168 @@
1
+ # Generic Loop Example: Repo Hygiene Audit
2
+
3
+ This example shows how to use `generic-loop` for a repository hygiene audit. It is a usage sample, not a new workflow engine. The loop produces an auditable Markdown report, pauses at human gates, and leaves evidence in artifacts, timeline, and the Dashboard.
4
+
5
+ Use this when you want a repeatable non-PR workflow such as checking docs, config, install notes, test entrypoints, and maintainer workflow consistency.
6
+
7
+ Do not use this for code PR delivery, automatic cleanup, arbitrary DAG orchestration, production operations, or any workflow that should bypass human approval.
8
+
9
+ ## Clean Repo Setup
10
+
11
+ Start from a clean target repository:
12
+
13
+ ```bash
14
+ git status --short
15
+ pnpm agent-loop init
16
+ pnpm agent-loop status --json
17
+ ```
18
+
19
+ Then edit `.agent-loop/config.json` in the target repository:
20
+
21
+ ```json
22
+ {
23
+ "repoId": "owner/repo",
24
+ "baseBranch": "main",
25
+ "plansDir": "docs/plans",
26
+ "loopShape": "generic-loop",
27
+ "workflowProfile": "repo_hygiene_loop",
28
+ "roleProfile": "default_pr_roles",
29
+ "requiredChecks": []
30
+ }
31
+ ```
32
+
33
+ Do not add `protectedPaths` unless you intend to replace the defaults. The default protected paths keep `.git/`, `.agent-loop/`, `.claude/`, `AGENTS.md`, `CLAUDE.md`, env files, and secret-like paths out of worker changes.
34
+
35
+ `repo_hygiene_loop` writes only report-style artifacts under the built-in allowed roots, currently `docs` and `reports`. Keep `.agent-loop/` out of commits; it is runtime state.
36
+
37
+ ## Goal
38
+
39
+ Use a concrete goal, for example:
40
+
41
+ ```text
42
+ Audit this repository for local install, docs, test command, handoff, and dashboard example drift. Produce a Markdown repo hygiene audit report with findings, severity, evidence, and recommended action. Do not edit source code or perform cleanup.
43
+ ```
44
+
45
+ The important part is the boundary: this loop can inspect the repo and write a report, but cleanup should remain explicit and scoped.
46
+
47
+ ## Command Flow
48
+
49
+ Run until the first human gate:
50
+
51
+ ```bash
52
+ pnpm agent-loop run --until=gate --json
53
+ pnpm agent-loop observe --json
54
+ ```
55
+
56
+ For a fresh generic-loop run, expect a goal confirmation gate:
57
+
58
+ ```json
59
+ {
60
+ "kind": "generic_goal_needs_confirmation",
61
+ "state": "DEFINE_GOAL",
62
+ "allowedNextStates": ["COLLECT_CONTEXT", "PLAN_WORK", "STOPPED"]
63
+ }
64
+ ```
65
+
66
+ This snippet shows the key fields. The full gate details also include profile metadata, `expectedDeliverable`, `defaultNextState`, and the required approval payload.
67
+
68
+ Approve it after confirming the goal and boundary:
69
+
70
+ ```bash
71
+ pnpm agent-loop approve-gate <gate-id> \
72
+ --next-state COLLECT_CONTEXT \
73
+ --note "Goal and report-only boundary confirmed."
74
+ pnpm agent-loop resume --json
75
+ ```
76
+
77
+ The loop should collect context, write a plan artifact, execute the audit report, self-review it, and then stop again at `generic_human_gate` before delivery:
78
+
79
+ ```bash
80
+ pnpm agent-loop observe --json
81
+ pnpm agent-loop timeline --limit 20 --json
82
+ pnpm agent-loop workers --events --json
83
+ ```
84
+
85
+ If the report is acceptable:
86
+
87
+ ```bash
88
+ pnpm agent-loop approve-gate <gate-id> \
89
+ --next-state DELIVER \
90
+ --note "Repo hygiene report approved for delivery."
91
+ pnpm agent-loop resume --json
92
+ ```
93
+
94
+ If the report needs changes:
95
+
96
+ ```bash
97
+ pnpm agent-loop approve-gate <gate-id> \
98
+ --next-state EXECUTE_STEP \
99
+ --note "Add missing install and dashboard evidence before delivery."
100
+ pnpm agent-loop resume --json
101
+ ```
102
+
103
+ ## Expected Artifacts
104
+
105
+ The run should register at least these artifact records. The Dashboard Artifact Viewer and JSON audit export include artifact paths. `timeline --source artifact` shows artifact entries by name, kind, hash, and artifact id.
106
+
107
+ | Kind | Typical name | Purpose |
108
+ | --- | --- | --- |
109
+ | `generic-context` | `context.md` | Captures collected context and profile metadata. |
110
+ | `generic-plan` | `plan.md` | Captures the plan, expected deliverable, required evidence, and review checklist. |
111
+ | `generic-deliverable` | `deliverable.md` | Captures the final approved handoff for the repo hygiene report. |
112
+ | worker result | worker-generated Markdown or JSON artifact | Contains the detailed audit report and worker evidence. |
113
+
114
+ The report should contain severity, evidence, and recommended action. It should not include raw secrets, private prompt text, or unrelated cleanup patches.
115
+
116
+ ## Timeline And Audit Validation
117
+
118
+ Validate the audit path with:
119
+
120
+ ```bash
121
+ mkdir -p reports
122
+ pnpm agent-loop timeline --source gate --limit 20 --json
123
+ pnpm agent-loop timeline --source artifact --limit 20 --json
124
+ pnpm agent-loop audit-export --run <run-id> --format markdown --output reports/repo-hygiene-audit.md
125
+ pnpm agent-loop audit-export --run <run-id> --format json --output reports/repo-hygiene-audit.json
126
+ ```
127
+
128
+ Expected evidence:
129
+
130
+ - A `generic_goal_needs_confirmation` gate before work starts.
131
+ - A `generic_plan_ready` decision after planning.
132
+ - Worker timeline entries for execute and self-review steps.
133
+ - Artifact timeline entries for context, plan, and deliverable records.
134
+ - Artifact paths in the Dashboard Artifact Viewer or `reports/repo-hygiene-audit.json`.
135
+ - A `generic_human_gate` before delivery.
136
+ - A `generic_loop_completed` event when the run reaches `COMPLETE`.
137
+
138
+ ## Dashboard Checks
139
+
140
+ Open the Dashboard:
141
+
142
+ ```bash
143
+ pnpm agent-loop dashboard
144
+ ```
145
+
146
+ In Mission Control and related views, confirm:
147
+
148
+ - The profile shows `loopShape=generic-loop` and `workflowProfile=repo_hygiene_loop`.
149
+ - Deliverable readiness replaces PR merge readiness.
150
+ - Gate Center shows the active generic gate and allowed next states.
151
+ - Artifacts include context, plan, and deliverable records.
152
+ - Timeline contains state, decision, gate, worker, and artifact entries for the run.
153
+ - Worker Runs shows planner, implementation, and reviewer roles, but the supervisor still owns Git and lifecycle actions.
154
+
155
+ ## Recovery Notes
156
+
157
+ If a worker fails, inspect before recovering:
158
+
159
+ ```bash
160
+ pnpm agent-loop observe --json
161
+ pnpm agent-loop workers --events --json
162
+ pnpm agent-loop recover --json
163
+ pnpm agent-loop resume --json
164
+ ```
165
+
166
+ If the worker requests a broader scope, the run should open `generic_scope_change_requested`. Approve only if the broader scope still belongs to this audit. Otherwise send it back to `PLAN_WORK` or stop the run.
167
+
168
+ Generic-loop completion returns the run to a non-running status with `COMPLETE` as the terminal state. To run another audit, start a new run instead of resuming a completed one.
@@ -0,0 +1,190 @@
1
+ # HOLO-Codex Install
2
+
3
+ English: Install the local-first plugin, configure MCP/hook integration, then initialize `.agent-loop/` state.
4
+
5
+ 中文:先安装本地优先插件,配置 MCP/hooks,再初始化 `.agent-loop/` 状态。
6
+
7
+ See also: [README](../README.md) / [中文 README](../README.zh-CN.md) / [Local Release Readiness](./local-release-readiness.md).
8
+
9
+ ## npm Install
10
+
11
+ ```bash
12
+ npm install --global holo-codex
13
+ ```
14
+
15
+ Initialize and bind a target repository:
16
+
17
+ ```bash
18
+ agent-loop --repo /path/to/repo init
19
+ agent-loop install-hooks --repo /path/to/repo
20
+ agent-loop --repo /path/to/repo doctor
21
+ agent-loop --repo /path/to/repo status
22
+ ```
23
+
24
+ The npm package provides the `agent-loop` CLI. `agent-loop install-hooks` installs or refreshes the hook router and target repository binding without reinstalling the global CLI. Use source `agent-loop local install` only when you want the pnpm-based snapshot/rollback install workflow.
25
+
26
+ ## Source Install
27
+
28
+ ```bash
29
+ git clone https://github.com/tizerluo/HOLO-Codex.git
30
+ cd HOLO-Codex
31
+ pnpm install
32
+ pnpm build:hooks
33
+ ```
34
+
35
+ Development CLI options:
36
+
37
+ ```bash
38
+ # From this repository
39
+ pnpm agent-loop status
40
+
41
+ # Safe local install with snapshot/rollback
42
+ # Replace /path/to/repo with the repository you want HOLO-Codex to supervise.
43
+ pnpm agent-loop local install --repo /path/to/repo
44
+ agent-loop --repo /path/to/repo status
45
+ ```
46
+
47
+ The canonical public source is `https://github.com/tizerluo/HOLO-Codex`. Use source install when developing HOLO-Codex, auditing the checkout, or testing local changes before a release. If pnpm reports that the global bin directory is not in `PATH`, add that directory to `PATH` before installing or use a shell profile managed by `pnpm setup`.
48
+
49
+ For the full fresh-machine checklist, including MCP env, hooks, dashboard login, and smoke tests, use [Local Release Readiness](./local-release-readiness.md).
50
+
51
+ ## Enable The Plugin
52
+
53
+ Add HOLO-Codex as a local Codex plugin marketplace. For npm installs:
54
+
55
+ ```bash
56
+ codex plugin marketplace add "$(npm root -g)/holo-codex"
57
+ ```
58
+
59
+ For source installs:
60
+
61
+ ```bash
62
+ codex plugin marketplace add /path/to/HOLO-Codex
63
+ ```
64
+
65
+ Then enable `autonomous-pr-loop` in Codex config using the local marketplace entry.
66
+
67
+ Plugin enablement and global CLI installation are separate. The marketplace entry enables Codex plugin/MCP/skill integration; the global install only exposes the `agent-loop` shell command.
68
+
69
+ ## Configure MCP
70
+
71
+ The plugin ships `plugins/autonomous-pr-loop/.mcp.json` with a stdio MCP server named `autonomous-pr-loop`.
72
+ Mutating MCP tools require a shared token. Set it in the Codex MCP server environment and pass the same value as `token` when calling mutating tools:
73
+
74
+ ```bash
75
+ export AGENT_LOOP_MCP_TOKEN="change-me"
76
+ ```
77
+
78
+ Manual fallback:
79
+
80
+ ```bash
81
+ codex mcp add autonomous-pr-loop \
82
+ --cwd /path/to/HOLO-Codex/plugins/autonomous-pr-loop \
83
+ -- pnpm exec tsx ./mcp-server/src/index.ts
84
+ ```
85
+
86
+ When using the global CLI from another repository, keep `AGENT_LOOP_REPO_ROOT=/path/to/repo` in the MCP server environment so mutating tools bind the intended target repository.
87
+
88
+ ## Initialize Local State
89
+
90
+ Current development packaging exposes both the repository-local command and the global command. Run either from the target repository, or pass `--repo <path>` to bind a target workspace:
91
+
92
+ ```bash
93
+ pnpm agent-loop init
94
+ pnpm agent-loop doctor
95
+ pnpm agent-loop status
96
+ pnpm agent-loop --repo /path/to/repo status
97
+ pnpm agent-loop --repo /path/to/repo dashboard
98
+ agent-loop --repo /path/to/repo status
99
+ agent-loop --repo /path/to/repo dashboard
100
+ ```
101
+
102
+ `--repo` is parsed as a global flag before command dispatch; do not use the literal `--repo` as the value of another command option.
103
+
104
+ `doctor` reports whether hooks are installed and whether config/storage/tool checks pass.
105
+
106
+ Runtime state is stored in the target repository's `.agent-loop/` and must not be committed.
107
+
108
+ ## Configure Hooks
109
+
110
+ Plugin hook auto-loading is not assumed. For a fresh target repository, initialize local state first, then install the hook router and target binding:
111
+
112
+ ```bash
113
+ agent-loop --repo /path/to/repo init
114
+ agent-loop install-hooks --repo /path/to/repo
115
+ ```
116
+
117
+ This installs one stable HOLO-Codex hook router into `~/.codex/hooks.json`, preserves existing user hooks, and records the target repository binding under `~/.codex/agent-loop/hook-bindings.json`.
118
+
119
+ Multi-repo note: multiple target repositories can share the same `CODEX_HOME`; hook events are routed by Codex cwd/worktree/session context before any repo state is written or policy is applied. Use a separate `CODEX_HOME` only when you want a fully isolated sandbox.
120
+
121
+ When starting real PR delivery work in that repository, bind after init/hooks:
122
+
123
+ ```bash
124
+ agent-loop --repo /path/to/repo delivery bind --issue ISSUE --title "..." --url https://github.com/OWNER/REPO/issues/ISSUE
125
+ ```
126
+
127
+ ## Upgrade, Reinstall, Or Uninstall
128
+
129
+ Upgrade or reinstall the global CLI from the plugin repository:
130
+
131
+ ```bash
132
+ git pull --ff-only
133
+ pnpm install
134
+ pnpm build:hooks
135
+ pnpm agent-loop local install --repo /path/to/repo
136
+ agent-loop --repo /path/to/repo doctor
137
+ ```
138
+
139
+ Rollback a local install with the snapshot path printed by install:
140
+
141
+ ```bash
142
+ agent-loop local rollback --snapshot /path/to/snapshot
143
+ ```
144
+
145
+ Rollback preserves malformed current hook files as `hooks.json.broken-<timestamp>` or `hook-bindings.json.broken-<timestamp>` before restoring the snapshot, so operators can inspect the broken file after recovery.
146
+
147
+ Inspect and prune old local-install snapshots:
148
+
149
+ ```bash
150
+ agent-loop local snapshots
151
+ agent-loop local snapshots prune --keep 10
152
+ agent-loop local snapshots prune --keep 10 --apply
153
+ ```
154
+
155
+ `prune` is dry-run by default. It deletes only valid old `local-install-*` snapshots when `--apply` is present; malformed snapshots are skipped with warnings.
156
+
157
+ Manual fallback: remove the global CLI package with `pnpm remove --global holo-codex`. Older local installs may still appear as `codex-auto-pr-loop-plugin`; inspect global packages with `pnpm list --global --depth 0` and remove the matching `agent-loop` provider. Hook router entries live in `~/.codex/hooks.json`; target bindings live in `~/.codex/agent-loop/hook-bindings.json` and can be removed with `agent-loop hooks unbind --repo /path/to/repo`.
158
+
159
+ For npm installs, remove the target binding first and then uninstall the global package:
160
+
161
+ ```bash
162
+ agent-loop hooks unbind --repo /path/to/repo
163
+ # If no target repositories still use HOLO-Codex hooks, remove the
164
+ # HOLO-Codex router entries from ~/.codex/hooks.json before uninstalling.
165
+ npm uninstall --global holo-codex
166
+ ```
167
+
168
+ Detailed upgrade, reinstall, uninstall, and global CLI resource checks are in [Local Release Readiness](./local-release-readiness.md).
169
+
170
+ ## Dashboard And Local Observability
171
+
172
+ Start the dashboard from this repository or through the global command:
173
+
174
+ ```bash
175
+ pnpm agent-loop --repo /path/to/repo dashboard
176
+ agent-loop --repo /path/to/repo dashboard
177
+ ```
178
+
179
+ The command prints a loopback URL on stdout and a fallback session token on stderr. Open the URL to load the local dashboard; loopback sessions unlock themselves through a same-origin bootstrap, and the browser sends the session token through the `x-agent-loop-token` header for dashboard mutations. The manual token login screen remains as a fallback for static UI, old links, or recovery.
180
+
181
+ Useful local observability commands:
182
+
183
+ ```bash
184
+ agent-loop --repo /path/to/repo timeline --limit 20
185
+ agent-loop --repo /path/to/repo workers --events
186
+ agent-loop --repo /path/to/repo observe
187
+ agent-loop --repo /path/to/repo audit-export --run RUN_ID --format markdown
188
+ ```
189
+
190
+ Theme and locale are browser-local display preferences. They do not change `.agent-loop/config.json` or SQLite state.
@@ -0,0 +1,206 @@
1
+ # HOLO-Codex Local Release Readiness Checklist
2
+
3
+ This checklist prepares HOLO-Codex for day-to-day use through the published npm package or the public GitHub source checkout.
4
+
5
+ ## Fresh Machine Setup
6
+
7
+ Install from npm:
8
+
9
+ ```bash
10
+ npm install --global holo-codex
11
+ agent-loop --help
12
+ agent-loop --repo /path/to/target-repo init
13
+ agent-loop install-hooks --repo /path/to/target-repo
14
+ agent-loop --repo /path/to/target-repo doctor
15
+ ```
16
+
17
+ Use the source checkout when developing or auditing the release:
18
+
19
+ ```bash
20
+ git clone https://github.com/tizerluo/HOLO-Codex.git
21
+ cd HOLO-Codex
22
+ pnpm install
23
+ pnpm build:hooks
24
+ pnpm agent-loop local install --repo /path/to/target-repo
25
+ agent-loop --help
26
+ ```
27
+
28
+ For npm installs, `agent-loop install-hooks` installs or migrates router hooks and binds the target repo without reinstalling the global CLI. For source installs, `agent-loop local install` snapshots `~/.codex/hooks.json` and `~/.codex/agent-loop/hook-bindings.json`, installs the global CLI, installs or migrates router hooks, binds the target repo, checks for accidental manifest churn, and prints the rollback command. If pnpm reports that the configured global bin directory is not in `PATH`, add that directory to `PATH` before source local install or run `pnpm setup` for your shell.
29
+
30
+ Enable the local Codex plugin separately from the global CLI install. For npm installs:
31
+
32
+ ```bash
33
+ codex plugin marketplace add "$(npm root -g)/holo-codex"
34
+ ```
35
+
36
+ For source installs:
37
+
38
+ ```bash
39
+ codex plugin marketplace add /path/to/HOLO-Codex
40
+ ```
41
+
42
+ Then enable `autonomous-pr-loop` in Codex from the local marketplace entry.
43
+
44
+ Configure the MCP token in the Codex MCP server environment. Mutating MCP tools must receive the same token in their `token` input:
45
+
46
+ ```bash
47
+ export AGENT_LOOP_MCP_TOKEN="change-me"
48
+ ```
49
+
50
+ When configuring the MCP server manually, keep the MCP cwd at the plugin directory and bind the intended target repository with `AGENT_LOOP_REPO_ROOT`:
51
+
52
+ ```bash
53
+ codex mcp add autonomous-pr-loop \
54
+ --cwd /path/to/HOLO-Codex/plugins/autonomous-pr-loop \
55
+ --env AGENT_LOOP_MCP_TOKEN="$AGENT_LOOP_MCP_TOKEN" \
56
+ --env AGENT_LOOP_REPO_ROOT=/path/to/target-repo \
57
+ -- pnpm exec tsx ./mcp-server/src/index.ts
58
+ ```
59
+
60
+ Initialize one target repository:
61
+
62
+ ```bash
63
+ agent-loop --repo /path/to/target-repo init
64
+ agent-loop --repo /path/to/target-repo doctor
65
+ agent-loop --repo /path/to/target-repo status
66
+ agent-loop install-hooks --repo /path/to/target-repo
67
+ agent-loop --repo /path/to/target-repo doctor
68
+ ```
69
+
70
+ Runtime state is written to the target repository's `.agent-loop/` directory. Do not commit `.agent-loop/`, SQLite files, tokens, or dashboard session output.
71
+
72
+ ## Upgrade Or Reinstall
73
+
74
+ For npm installs:
75
+
76
+ ```bash
77
+ npm update --global holo-codex
78
+ agent-loop install-hooks --repo /path/to/target-repo
79
+ agent-loop --repo /path/to/target-repo doctor
80
+ agent-loop --repo /path/to/target-repo status
81
+ ```
82
+
83
+ For source checkouts:
84
+
85
+ ```bash
86
+ cd /path/to/HOLO-Codex
87
+ git pull --ff-only
88
+ pnpm install
89
+ pnpm build:hooks
90
+ pnpm agent-loop local install --repo /path/to/target-repo
91
+ agent-loop --repo /path/to/target-repo doctor
92
+ agent-loop --repo /path/to/target-repo status
93
+ ```
94
+
95
+ Re-run `install-hooks` after updates because router hook commands include the current plugin install path and compiled hook runner paths. The target binding remains in `~/.codex/agent-loop/hook-bindings.json` and is refreshed by the same command.
96
+
97
+ If `doctor` reports stale or missing compiled hooks, run:
98
+
99
+ ```bash
100
+ pnpm build:hooks
101
+ agent-loop install-hooks --repo /path/to/target-repo
102
+ ```
103
+
104
+ ## Uninstall Global CLI
105
+
106
+ For npm installs:
107
+
108
+ ```bash
109
+ agent-loop hooks unbind --repo /path/to/target-repo
110
+ # If no target repositories still use HOLO-Codex hooks, remove the
111
+ # HOLO-Codex router entries from ~/.codex/hooks.json before uninstalling.
112
+ npm uninstall --global holo-codex
113
+ ```
114
+
115
+ For source local installs, use the rollback snapshot printed by install:
116
+
117
+
118
+ ```bash
119
+ agent-loop local rollback --snapshot /path/to/snapshot
120
+ ```
121
+
122
+ If rollback encounters malformed current hook state, it preserves the bad file as `hooks.json.broken-<timestamp>` or `hook-bindings.json.broken-<timestamp>` before restoring the snapshot. Keep these files only long enough for manual inspection.
123
+
124
+ Inspect and safely prune old install snapshots:
125
+
126
+ ```bash
127
+ agent-loop local snapshots
128
+ agent-loop local snapshots prune --keep 10
129
+ agent-loop local snapshots prune --keep 10 --apply
130
+ ```
131
+
132
+ `local snapshots prune` is a dry-run unless `--apply` is present. It skips malformed snapshots and reports warnings instead of deleting them.
133
+
134
+ Manual source fallback: if pnpm reports the package name differently or rollback cannot remove the global command, inspect global packages and remove the matching `agent-loop` provider:
135
+
136
+ ```bash
137
+ pnpm list --global --depth 0
138
+ pnpm remove --global holo-codex
139
+ ```
140
+
141
+ Older local source installs may still be listed as `codex-auto-pr-loop-plugin`; remove that package name when it is the provider shown by `pnpm list --global --depth 0`.
142
+
143
+ Remove a target binding when that repository should no longer participate in the Codex hook loop:
144
+
145
+ ```bash
146
+ agent-loop hooks unbind --repo /path/to/target-repo
147
+ ```
148
+
149
+ The router entries live in `~/.codex/hooks.json`; target bindings live in `~/.codex/agent-loop/hook-bindings.json`. Remove router entries only when no target repository should use agent-loop hooks.
150
+
151
+ Remove the local plugin marketplace entry through Codex plugin management if you no longer want Codex to see the plugin. Do not delete `.agent-loop/` from a target repo unless you intentionally want to discard its local loop state.
152
+
153
+ ## Global CLI Resource Smoke
154
+
155
+ From any directory outside the target repository, verify that global CLI commands bind the target repo while loading plugin resources from the plugin repository:
156
+
157
+ ```bash
158
+ agent-loop --repo /path/to/target-repo status --json
159
+ agent-loop --repo /path/to/target-repo observe --json
160
+ agent-loop --repo /path/to/target-repo dashboard
161
+ agent-loop install-hooks --repo /path/to/target-repo
162
+ agent-loop local doctor --repo /path/to/target-repo
163
+ ```
164
+
165
+ Expected results:
166
+
167
+ - `status --json` reports the target repository's `.agent-loop/state.sqlite`.
168
+ - `observe --json` reports the target dashboard URL and current run/gate state.
169
+ - `dashboard` serves the plugin dashboard UI, prints the loopback URL on stdout, and prints the session token on stderr.
170
+ - `install-hooks` writes one router hook command per Codex hook event, removes legacy per-repo agent-loop hook entries, and records the target repo binding in `~/.codex/agent-loop/hook-bindings.json`.
171
+ - `local doctor` reports the first `agent-loop` on `PATH`, whether it points to the expected package root, router hook dist drift, legacy entries, binding counts, stale/temp bindings, registry lock state, and self-link manifest pollution.
172
+ - MCP server cwd remains the plugin MCP directory; `AGENT_LOOP_REPO_ROOT` binds mutating tools to the target repo.
173
+ - Schemas remain package resources under `plugins/autonomous-pr-loop/schemas/`.
174
+
175
+ ## Operator Smoke Tests
176
+
177
+ Before using the loop on real work, run:
178
+
179
+ ```bash
180
+ agent-loop --repo /path/to/target-repo doctor
181
+ agent-loop --repo /path/to/target-repo status --json
182
+ agent-loop --repo /path/to/target-repo observe --json
183
+ agent-loop --repo /path/to/target-repo timeline --limit 20
184
+ agent-loop --repo /path/to/target-repo workers --events
185
+ ```
186
+
187
+ Dashboard smoke:
188
+
189
+ ```bash
190
+ agent-loop --repo /path/to/target-repo dashboard
191
+ ```
192
+
193
+ Open the printed loopback URL and confirm Mission Control loads the target repository without manual token entry. The stderr token is a fallback local session secret for static UI or recovery only; do not paste or store it in docs, logs, PR bodies, commits, issue comments, artifacts, or screenshots.
194
+
195
+ MCP smoke:
196
+
197
+ - `loop_status` returns the same target repo state as `agent-loop --repo /path/to/target-repo status --json`.
198
+ - Mutating tools without a token return `needs_secret_or_login`.
199
+ - Mutating tools with the configured token bind the repository named by `AGENT_LOOP_REPO_ROOT`.
200
+
201
+ ## Out Of Scope
202
+
203
+ - automatic upgrade or uninstall scripts.
204
+ - shell completion.
205
+ - hosted service, daemon, or GitHub webhooks.
206
+ - multi-version local marketplace management.