@sireai/optimus 0.1.1

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 (204) hide show
  1. package/.env.example +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +104 -0
  4. package/dist/cli/optimus.d.ts +2 -0
  5. package/dist/cli/optimus.js +2951 -0
  6. package/dist/cli/optimus.js.map +1 -0
  7. package/dist/cli/self-update.d.ts +49 -0
  8. package/dist/cli/self-update.js +264 -0
  9. package/dist/cli/self-update.js.map +1 -0
  10. package/dist/config/load-config.d.ts +3 -0
  11. package/dist/config/load-config.js +321 -0
  12. package/dist/config/load-config.js.map +1 -0
  13. package/dist/config/optimus-paths.d.ts +13 -0
  14. package/dist/config/optimus-paths.js +44 -0
  15. package/dist/config/optimus-paths.js.map +1 -0
  16. package/dist/index.d.ts +25 -0
  17. package/dist/index.js +27 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/integrations/jira/jira-cli.d.ts +1 -0
  20. package/dist/integrations/jira/jira-cli.js +278 -0
  21. package/dist/integrations/jira/jira-cli.js.map +1 -0
  22. package/dist/integrations/jira/jira-client.d.ts +99 -0
  23. package/dist/integrations/jira/jira-client.js +521 -0
  24. package/dist/integrations/jira/jira-client.js.map +1 -0
  25. package/dist/integrations/jira/jira-submit.d.ts +71 -0
  26. package/dist/integrations/jira/jira-submit.js +351 -0
  27. package/dist/integrations/jira/jira-submit.js.map +1 -0
  28. package/dist/problem-solving-core/codex/codex-auth-resolver.d.ts +23 -0
  29. package/dist/problem-solving-core/codex/codex-auth-resolver.js +136 -0
  30. package/dist/problem-solving-core/codex/codex-auth-resolver.js.map +1 -0
  31. package/dist/problem-solving-core/codex/codex-connectivity-checks.d.ts +6 -0
  32. package/dist/problem-solving-core/codex/codex-connectivity-checks.js +81 -0
  33. package/dist/problem-solving-core/codex/codex-connectivity-checks.js.map +1 -0
  34. package/dist/problem-solving-core/codex/codex-failure-classifier.d.ts +2 -0
  35. package/dist/problem-solving-core/codex/codex-failure-classifier.js +49 -0
  36. package/dist/problem-solving-core/codex/codex-failure-classifier.js.map +1 -0
  37. package/dist/problem-solving-core/codex/codex-global-config.d.ts +17 -0
  38. package/dist/problem-solving-core/codex/codex-global-config.js +100 -0
  39. package/dist/problem-solving-core/codex/codex-global-config.js.map +1 -0
  40. package/dist/problem-solving-core/codex/codex-preflight.d.ts +13 -0
  41. package/dist/problem-solving-core/codex/codex-preflight.js +142 -0
  42. package/dist/problem-solving-core/codex/codex-preflight.js.map +1 -0
  43. package/dist/problem-solving-core/codex/codex-provider-profile.d.ts +14 -0
  44. package/dist/problem-solving-core/codex/codex-provider-profile.js +68 -0
  45. package/dist/problem-solving-core/codex/codex-provider-profile.js.map +1 -0
  46. package/dist/problem-solving-core/codex/codex-required-env.d.ts +3 -0
  47. package/dist/problem-solving-core/codex/codex-required-env.js +21 -0
  48. package/dist/problem-solving-core/codex/codex-required-env.js.map +1 -0
  49. package/dist/problem-solving-core/codex/codex-runner.d.ts +37 -0
  50. package/dist/problem-solving-core/codex/codex-runner.js +926 -0
  51. package/dist/problem-solving-core/codex/codex-runner.js.map +1 -0
  52. package/dist/problem-solving-core/codex/evolution-skill-guard.d.ts +36 -0
  53. package/dist/problem-solving-core/codex/evolution-skill-guard.js +143 -0
  54. package/dist/problem-solving-core/codex/evolution-skill-guard.js.map +1 -0
  55. package/dist/problem-solving-core/codex/repo-memory-service.d.ts +24 -0
  56. package/dist/problem-solving-core/codex/repo-memory-service.js +114 -0
  57. package/dist/problem-solving-core/codex/repo-memory-service.js.map +1 -0
  58. package/dist/problem-solving-core/codex/skill-sync-service.d.ts +35 -0
  59. package/dist/problem-solving-core/codex/skill-sync-service.js +280 -0
  60. package/dist/problem-solving-core/codex/skill-sync-service.js.map +1 -0
  61. package/dist/task-environment/cancellation/task-abort-registry.d.ts +17 -0
  62. package/dist/task-environment/cancellation/task-abort-registry.js +51 -0
  63. package/dist/task-environment/cancellation/task-abort-registry.js.map +1 -0
  64. package/dist/task-environment/cancellation/task-cancellation-service.d.ts +25 -0
  65. package/dist/task-environment/cancellation/task-cancellation-service.js +54 -0
  66. package/dist/task-environment/cancellation/task-cancellation-service.js.map +1 -0
  67. package/dist/task-environment/cancellation/task-cleanup-service.d.ts +22 -0
  68. package/dist/task-environment/cancellation/task-cleanup-service.js +67 -0
  69. package/dist/task-environment/cancellation/task-cleanup-service.js.map +1 -0
  70. package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.d.ts +13 -0
  71. package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.js +83 -0
  72. package/dist/task-environment/delivery/commit-message/bugfix-commit-message-template.js.map +1 -0
  73. package/dist/task-environment/delivery/commit-message/commit-message-builder.d.ts +6 -0
  74. package/dist/task-environment/delivery/commit-message/commit-message-builder.js +15 -0
  75. package/dist/task-environment/delivery/commit-message/commit-message-builder.js.map +1 -0
  76. package/dist/task-environment/delivery/commit-message/commit-message-template-types.d.ts +16 -0
  77. package/dist/task-environment/delivery/commit-message/commit-message-template-types.js +2 -0
  78. package/dist/task-environment/delivery/commit-message/commit-message-template-types.js.map +1 -0
  79. package/dist/task-environment/delivery/feishu-analysis-doc-service.d.ts +50 -0
  80. package/dist/task-environment/delivery/feishu-analysis-doc-service.js +454 -0
  81. package/dist/task-environment/delivery/feishu-analysis-doc-service.js.map +1 -0
  82. package/dist/task-environment/delivery/feishu-card-renderer.d.ts +38 -0
  83. package/dist/task-environment/delivery/feishu-card-renderer.js +449 -0
  84. package/dist/task-environment/delivery/feishu-card-renderer.js.map +1 -0
  85. package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.d.ts +34 -0
  86. package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js +201 -0
  87. package/dist/task-environment/delivery/feishu-content/feishu-content-renderer.js.map +1 -0
  88. package/dist/task-environment/delivery/feishu-content/feishu-copy-config.d.ts +27 -0
  89. package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js +74 -0
  90. package/dist/task-environment/delivery/feishu-content/feishu-copy-config.js.map +1 -0
  91. package/dist/task-environment/delivery/feishu-notifier.d.ts +45 -0
  92. package/dist/task-environment/delivery/feishu-notifier.js +250 -0
  93. package/dist/task-environment/delivery/feishu-notifier.js.map +1 -0
  94. package/dist/task-environment/delivery/feishu-templates/analysis-message-template.d.ts +6 -0
  95. package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js +39 -0
  96. package/dist/task-environment/delivery/feishu-templates/analysis-message-template.js.map +1 -0
  97. package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.d.ts +6 -0
  98. package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js +40 -0
  99. package/dist/task-environment/delivery/feishu-templates/bugfix-message-template.js.map +1 -0
  100. package/dist/task-environment/delivery/feishu-templates/default-message-template.d.ts +6 -0
  101. package/dist/task-environment/delivery/feishu-templates/default-message-template.js +33 -0
  102. package/dist/task-environment/delivery/feishu-templates/default-message-template.js.map +1 -0
  103. package/dist/task-environment/delivery/feishu-templates/patch-message-template.d.ts +6 -0
  104. package/dist/task-environment/delivery/feishu-templates/patch-message-template.js +40 -0
  105. package/dist/task-environment/delivery/feishu-templates/patch-message-template.js.map +1 -0
  106. package/dist/task-environment/delivery/feishu-templates/template-registry.d.ts +2 -0
  107. package/dist/task-environment/delivery/feishu-templates/template-registry.js +11 -0
  108. package/dist/task-environment/delivery/feishu-templates/template-registry.js.map +1 -0
  109. package/dist/task-environment/delivery/feishu-templates/template-types.d.ts +20 -0
  110. package/dist/task-environment/delivery/feishu-templates/template-types.js +2 -0
  111. package/dist/task-environment/delivery/feishu-templates/template-types.js.map +1 -0
  112. package/dist/task-environment/delivery/task-delivery-dispatcher.d.ts +14 -0
  113. package/dist/task-environment/delivery/task-delivery-dispatcher.js +109 -0
  114. package/dist/task-environment/delivery/task-delivery-dispatcher.js.map +1 -0
  115. package/dist/task-environment/delivery/task-delivery-service.d.ts +33 -0
  116. package/dist/task-environment/delivery/task-delivery-service.js +432 -0
  117. package/dist/task-environment/delivery/task-delivery-service.js.map +1 -0
  118. package/dist/task-environment/delivery/task-publication-service.d.ts +97 -0
  119. package/dist/task-environment/delivery/task-publication-service.js +1369 -0
  120. package/dist/task-environment/delivery/task-publication-service.js.map +1 -0
  121. package/dist/task-environment/execution-addresses.d.ts +40 -0
  122. package/dist/task-environment/execution-addresses.js +63 -0
  123. package/dist/task-environment/execution-addresses.js.map +1 -0
  124. package/dist/task-environment/intake/cli-file-intake.d.ts +12 -0
  125. package/dist/task-environment/intake/cli-file-intake.js +56 -0
  126. package/dist/task-environment/intake/cli-file-intake.js.map +1 -0
  127. package/dist/task-environment/intake/manual-problem-intake.d.ts +3 -0
  128. package/dist/task-environment/intake/manual-problem-intake.js +57 -0
  129. package/dist/task-environment/intake/manual-problem-intake.js.map +1 -0
  130. package/dist/task-environment/intake/polling-problem-intake.d.ts +14 -0
  131. package/dist/task-environment/intake/polling-problem-intake.js +232 -0
  132. package/dist/task-environment/intake/polling-problem-intake.js.map +1 -0
  133. package/dist/task-environment/observability/logger.d.ts +76 -0
  134. package/dist/task-environment/observability/logger.js +604 -0
  135. package/dist/task-environment/observability/logger.js.map +1 -0
  136. package/dist/task-environment/observability/runtime-panel.d.ts +82 -0
  137. package/dist/task-environment/observability/runtime-panel.js +1008 -0
  138. package/dist/task-environment/observability/runtime-panel.js.map +1 -0
  139. package/dist/task-environment/observability/sound-notifier.d.ts +18 -0
  140. package/dist/task-environment/observability/sound-notifier.js +71 -0
  141. package/dist/task-environment/observability/sound-notifier.js.map +1 -0
  142. package/dist/task-environment/orchestration/execution-context-assembler.d.ts +41 -0
  143. package/dist/task-environment/orchestration/execution-context-assembler.js +464 -0
  144. package/dist/task-environment/orchestration/execution-context-assembler.js.map +1 -0
  145. package/dist/task-environment/orchestration/git-change-classifier.d.ts +19 -0
  146. package/dist/task-environment/orchestration/git-change-classifier.js +106 -0
  147. package/dist/task-environment/orchestration/git-change-classifier.js.map +1 -0
  148. package/dist/task-environment/orchestration/harness-registry.d.ts +27 -0
  149. package/dist/task-environment/orchestration/harness-registry.js +116 -0
  150. package/dist/task-environment/orchestration/harness-registry.js.map +1 -0
  151. package/dist/task-environment/orchestration/harness-resolver.d.ts +8 -0
  152. package/dist/task-environment/orchestration/harness-resolver.js +39 -0
  153. package/dist/task-environment/orchestration/harness-resolver.js.map +1 -0
  154. package/dist/task-environment/orchestration/task-orchestrator.d.ts +45 -0
  155. package/dist/task-environment/orchestration/task-orchestrator.js +1122 -0
  156. package/dist/task-environment/orchestration/task-orchestrator.js.map +1 -0
  157. package/dist/task-environment/orchestration/task-package-assembler.d.ts +4 -0
  158. package/dist/task-environment/orchestration/task-package-assembler.js +10 -0
  159. package/dist/task-environment/orchestration/task-package-assembler.js.map +1 -0
  160. package/dist/task-environment/orchestration/triage-agent.d.ts +54 -0
  161. package/dist/task-environment/orchestration/triage-agent.js +636 -0
  162. package/dist/task-environment/orchestration/triage-agent.js.map +1 -0
  163. package/dist/task-environment/orchestration/triage-runner.d.ts +65 -0
  164. package/dist/task-environment/orchestration/triage-runner.js +655 -0
  165. package/dist/task-environment/orchestration/triage-runner.js.map +1 -0
  166. package/dist/task-environment/publication-target.d.ts +12 -0
  167. package/dist/task-environment/publication-target.js +174 -0
  168. package/dist/task-environment/publication-target.js.map +1 -0
  169. package/dist/task-environment/runtime/blocking-event-queue.d.ts +7 -0
  170. package/dist/task-environment/runtime/blocking-event-queue.js +27 -0
  171. package/dist/task-environment/runtime/blocking-event-queue.js.map +1 -0
  172. package/dist/task-environment/runtime/optimus-runtime.d.ts +69 -0
  173. package/dist/task-environment/runtime/optimus-runtime.js +751 -0
  174. package/dist/task-environment/runtime/optimus-runtime.js.map +1 -0
  175. package/dist/task-environment/storage/sqlite-event-store.d.ts +52 -0
  176. package/dist/task-environment/storage/sqlite-event-store.js +288 -0
  177. package/dist/task-environment/storage/sqlite-event-store.js.map +1 -0
  178. package/dist/task-environment/storage/sqlite-task-store.d.ts +122 -0
  179. package/dist/task-environment/storage/sqlite-task-store.js +1182 -0
  180. package/dist/task-environment/storage/sqlite-task-store.js.map +1 -0
  181. package/dist/types.d.ts +629 -0
  182. package/dist/types.js +2 -0
  183. package/dist/types.js.map +1 -0
  184. package/embedded-skills/shared/repo-inspection/SKILL.md +9 -0
  185. package/embedded-skills/shared/repo-inspection/skill.json +5 -0
  186. package/embedded-skills/task/bugfix/android-debug-protocol/SKILL.md +10 -0
  187. package/embedded-skills/task/bugfix/android-debug-protocol/skill.json +6 -0
  188. package/harness/AGENTS.md +30 -0
  189. package/harness/CHECKLIST.md +44 -0
  190. package/harness/CONSTRAINTS.md +60 -0
  191. package/harness/FRAMEWORK.md +28 -0
  192. package/harness/GOAL.md +28 -0
  193. package/harness/HANDOFF.md +45 -0
  194. package/harness/TASK_PLAN.md +79 -0
  195. package/optimus.config.template.json +34 -0
  196. package/package.json +109 -0
  197. package/task-harnesses/bugfix/ACCEPT.md +47 -0
  198. package/task-harnesses/bugfix/CONSTRAINTS.md +46 -0
  199. package/task-harnesses/bugfix/CONTEXT.md +29 -0
  200. package/task-harnesses/bugfix/EVOLUTION.md +82 -0
  201. package/task-harnesses/bugfix/ROLE.md +29 -0
  202. package/task-harnesses/bugfix/STANDARD.md +250 -0
  203. package/task-harnesses/bugfix/manifest.json +13 -0
  204. package/task-harnesses/registry.json +8 -0
@@ -0,0 +1,44 @@
1
+ # Checklist
2
+
3
+ Run this after any meaningful code, design, validation, or doc change.
4
+
5
+ ## Engineering
6
+
7
+ - layering still matches `runtime / orchestration / runner / storage`
8
+ - new behavior lives in the right module
9
+ - commands, config, runtime paths, and docs still agree
10
+ - setup, auth, and doctor entrypoints stay simple
11
+ - task status, health, and result return still have clear inspection paths
12
+
13
+ ## Product and Architecture
14
+
15
+ - product still behaves like a task-execution agent
16
+ - CLI direction still converges on installable, diagnosable, recoverable operation
17
+ - docs still match the main flow: triage -> executor -> status return
18
+ - harness still means task-type control artifacts, not loose prompts
19
+
20
+ ## Operations
21
+
22
+ - common command errors point to the exact bad input
23
+ - `doctor` distinguishes blockers from degradations
24
+ - failure output answers: what failed, why, next action
25
+
26
+ ## Validation
27
+
28
+ - key signals and failure criteria are defined
29
+ - the change explains why tasks fail, stall, or do not start
30
+ - if observability is missing, add that before adding more features
31
+
32
+ ## Docs
33
+
34
+ - architecture changes updated `doc/optimus_architecture_design.md`
35
+ - product changes updated `doc/optimus_product_prd.md`
36
+ - harness-boundary changes updated `harness/FRAMEWORK.md`
37
+ - stage changes updated `GOAL.md`, `TASK_PLAN.md`, or `HANDOFF.md`
38
+
39
+ ## Before Push
40
+
41
+ - `npm run typecheck`
42
+ - `npm run build`
43
+ - `npm test`
44
+ - `npm run db-inspect`
@@ -0,0 +1,60 @@
1
+ # Constraints and Invariants
2
+
3
+ This is the single constraint file for relay work on Optimus.
4
+
5
+ ## Must Hold
6
+
7
+ - TypeScript is the primary language
8
+ - the project ships as an npm package
9
+ - first-use flow converges to a small set of clear entrypoints
10
+ - system layering stays explicit between `Task Environment` and `Problem-Solving Core`
11
+ - all task intake converges to the unified task model
12
+ - task-type harnesses live under `task-harnesses/`
13
+ - resident `TriageRunner` owns final accept / reject / route decisions
14
+ - triage loads full `ACCEPT.md` content at startup and reuses the resident thread
15
+ - `ACCEPT.md` is the only source of triage contract
16
+ - main-flow changes must add observable signals and feedback
17
+ - user-facing diagnostics must separate blockers from degradations and give a fix action
18
+ - common CLI commands must validate parameters and emit precise help and errors
19
+ - docs stay split by audience: user, operator, developer, relay harness
20
+ - runtime implementations favor short paths, low overhead, and explicit state
21
+
22
+ ## Must Not Happen
23
+
24
+ - scheduler logic inside `CodexRunner`
25
+ - triage semantics hidden inside `manifest.json`
26
+ - local fallback rules after resident triage startup failure
27
+ - triage contract duplicated into `ROLE.md`, registry fields, or code constants
28
+ - long-term rules written into `HANDOFF.md`
29
+ - user docs, ops docs, and relay docs merged into one long-lived file
30
+ - main-flow changes without observability
31
+ - new loops, queues, or state layers when a simpler direct model exists
32
+
33
+ ## Design and Validation
34
+
35
+ - do not stop at "it runs"; define key signals and failure criteria first
36
+ - after validation, iterate on feedback instead of only describing symptoms
37
+ - observability must explain delay, instability, and next corrective action
38
+ - once architecture direction is clear, prefer blocking wait, event-driven flow, short critical paths, and fewer state transitions
39
+ - every design should answer: less idle waiting, fewer middle layers, lower state complexity, better recovery
40
+
41
+ ## Code Readability
42
+
43
+ - new or changed critical logic must be commented
44
+ - comments should explain responsibility, state transition reason, boundary, or contract
45
+ - use section comments for main-flow logic, state transitions, storage, auth, fallback, triage, and harness assembly
46
+ - trivial syntax comments are noise
47
+ - keep module structure recognizable by responsibility
48
+
49
+ ## Review
50
+
51
+ - no push, merge, or release without code review
52
+ - review shared code touched by the change, not just the current unstaged diff
53
+ - findings should prioritize bugs, regressions, contract breaks, missing validation, and doc drift
54
+
55
+ ## Doc Sync
56
+
57
+ - update architecture doc when architecture changes
58
+ - update `GOAL.md` or `TASK_PLAN.md` when stage goals change
59
+ - update `HANDOFF.md` when current status, risk, or validation changes
60
+ - update `FRAMEWORK.md` when document boundaries change
@@ -0,0 +1,28 @@
1
+ # Harness Framework
2
+
3
+ `harness/` is the relay control plane for ongoing engineering work.
4
+
5
+ ## Layers
6
+
7
+ - entry: `AGENTS.md`
8
+ - constraints: `CONSTRAINTS.md`
9
+ - checklist: `CHECKLIST.md`
10
+ - product: `doc/optimus_product_prd.md`
11
+ - architecture: `doc/optimus_architecture_design.md`
12
+ - goal: `GOAL.md`
13
+ - plan: `TASK_PLAN.md`
14
+ - handoff: `HANDOFF.md`
15
+
16
+ ## Boundaries
17
+
18
+ - `harness/`: relay rules, stage goals, current state
19
+ - `doc/`: long-lived user, product, architecture, and maintenance docs
20
+ - `task-harnesses/`: task-type artifacts used by the runtime
21
+
22
+ ## Update Rules
23
+
24
+ - long-term rules -> `CONSTRAINTS.md`
25
+ - product meaning -> PRD
26
+ - architecture boundaries -> architecture doc
27
+ - stage priorities -> `GOAL.md` or `TASK_PLAN.md`
28
+ - recent state, risk, validation -> `HANDOFF.md`
@@ -0,0 +1,28 @@
1
+ # Goal and Boundary
2
+
3
+ ## Project Goal
4
+
5
+ - build a task-execution AI agent system
6
+ - keep problem intake, routing, execution, and result return continuous and governable
7
+ - keep Codex as the current executor, harness as the task control layer, and runtime as the resident governance layer
8
+
9
+ ## Current Stage Goal
10
+
11
+ - converge Optimus into an installable, initializable, diagnosable, recoverable, deliverable npm CLI
12
+ - simplify setup, config, auth, and common-command experience
13
+ - keep `doctor` focused on real run blockers and clear fixes
14
+ - cleanly separate user docs, ops docs, developer docs, and relay docs
15
+ - keep runtime, delivery, and publication stable while productizing the CLI
16
+
17
+ ## Current Non-Goals
18
+
19
+ - full platform UI
20
+ - ungoverned automatic merges
21
+ - agent-selected permissions
22
+ - rollback to a CLI-scripted task-harness narrative
23
+ - breaking harness, review, or delivery boundaries for convenience
24
+
25
+ ## Entry Docs
26
+
27
+ - product: `doc/optimus_product_prd.md`
28
+ - architecture: `doc/optimus_architecture_design.md`
@@ -0,0 +1,45 @@
1
+ # Handoff
2
+
3
+ ## Current State
4
+
5
+ - product positioning is aligned around a task-execution AI agent
6
+ - the main system flow is aligned around `raw problem -> triage -> task package -> harnessed execution -> status/result return`
7
+ - persistence is SQLite-based
8
+ - Codex integration is SDK-based
9
+ - triage is resident and reuses preloaded `ACCEPT.md` contracts
10
+ - current focus is CLI productization: setup, config, doctor, interaction, and doc boundaries
11
+
12
+ ## Recently Landed
13
+
14
+ - PRD, architecture, and maintenance docs were rewritten around the current product model
15
+ - harness docs were clarified as relay-control artifacts, not user docs
16
+ - runtime views are clearer across `doctor`, `task-status`, and `db-inspect`
17
+ - self-update and npm release flow were added
18
+
19
+ ## Open Work
20
+
21
+ - harness registry is still a minimal directory model
22
+ - platform status write-back is still incomplete
23
+ - patch validation and review-packet quality still need work
24
+ - first-run flow, auth flow, and doctor boundaries can still be simplified
25
+
26
+ ## Current Risks
27
+
28
+ - Codex auth and provider quality still heavily affect runtime reliability
29
+ - state machine changes require synchronized code and doc updates
30
+ - resident triage depends on harness digest and session resume semantics
31
+ - CLI changes without doc and error-output alignment will raise usage cost
32
+
33
+ ## Validation Baseline
34
+
35
+ - `npm run typecheck`
36
+ - `npm run build`
37
+ - `npm test`
38
+ - `npm run db-inspect`
39
+
40
+ ## Next Entry Point
41
+
42
+ 1. read `harness/AGENTS.md`
43
+ 2. read the PRD and architecture docs
44
+ 3. run the validation baseline
45
+ 4. continue from `harness/TASK_PLAN.md`
@@ -0,0 +1,79 @@
1
+ # Task Plan
2
+
3
+ ## Theme
4
+
5
+ Shift from "fill missing core-path capability" to "converge Optimus into an installable, diagnosable, recoverable npm CLI."
6
+
7
+ ## Stage Goals
8
+
9
+ - shortest possible first-run path after install
10
+ - simpler config and auth entrypoints
11
+ - `doctor` that checks only real blockers and degradations
12
+ - common commands with stable validation and actionable errors
13
+ - clear doc split across user, ops, developer, and relay audiences
14
+ - no regression to task, harness, delivery, or publication core paths
15
+
16
+ ## Principles
17
+
18
+ - close the first-run loop before expanding advanced features
19
+ - converge user entrypoints before exposing low-level config
20
+ - every failure output should answer: what failed, why, next step
21
+ - docs should be split by reader, not accumulated into one file
22
+ - productization must not break `task package -> harness -> execution -> delivery/publication`
23
+
24
+ ## Priority Plan
25
+
26
+ ### P0 First-run loop
27
+
28
+ - stable install command
29
+ - `optimus setup` as the only init entrypoint
30
+ - setup generates full config and ends with `doctor --quick`
31
+ - quick start stays aligned with real CLI output
32
+
33
+ ### P1 Config and auth convergence
34
+
35
+ - reduce exposed low-level config fields
36
+ - clarify which values are built in versus user-supplied
37
+ - make credential source explainable
38
+
39
+ ### P2 Doctor and ops
40
+
41
+ - keep `doctor` focused on true blockers and degradations
42
+ - improve repair guidance
43
+ - strengthen support and retry workflows
44
+
45
+ ### P3 Command experience
46
+
47
+ - normalize help, examples, and error output
48
+ - tighten validation for submit, Jira, repo, status, result, and delivery commands
49
+ - keep output categories explicit: execution, delivery, notification, publication
50
+
51
+ ### P4 Documentation
52
+
53
+ - keep user, ops, developer, and relay docs separated
54
+ - keep doc entrypoints obvious
55
+ - keep docs synchronized with real CLI behavior
56
+
57
+ ## Suggested Order
58
+
59
+ 1. P0
60
+ 2. P1
61
+ 3. P2
62
+ 4. P3
63
+ 5. P4
64
+
65
+ ## Not in Scope
66
+
67
+ - large web UI work
68
+ - multi-tenant permission center
69
+ - wide command renames without product value
70
+ - reducing installation friction by weakening review or delivery boundaries
71
+ - release before review, diagnostics, and docs are aligned
72
+
73
+ ## Acceptance
74
+
75
+ - a new user can install, setup, diagnose, and submit a first task
76
+ - an existing user can understand config, auth, and missing prerequisites quickly
77
+ - `doctor` clearly separates blockers from degradations
78
+ - common-command error messages are precise and actionable
79
+ - doc boundaries remain clean while core-path tests stay stable
@@ -0,0 +1,34 @@
1
+ {
2
+ "runtime": {
3
+ "workerConcurrency": 1,
4
+ "taskHarnessRootDir": "task-harnesses",
5
+ "networkAccessEnabled": true
6
+ },
7
+ "storage": {
8
+ "rootDir": ".optimus-runtime"
9
+ },
10
+ "observability": {
11
+ "enabled": true,
12
+ "mode": "debug",
13
+ "consoleLevel": "info",
14
+ "fileLevel": "debug",
15
+ "soundEnabled": false
16
+ },
17
+ "codex": {
18
+ "model": "openai/gpt-5.4",
19
+ "provider": "palebluedot",
20
+ "reasoningEffort": "medium",
21
+ "approvalPolicy": "never",
22
+ "sandboxMode": "workspace-write"
23
+ },
24
+ "delivery": {
25
+ "enabled": true,
26
+ "channels": ["console"],
27
+ "summaryStyle": "dense"
28
+ },
29
+ "publication": {
30
+ "enabled": true,
31
+ "dryRun": true,
32
+ "reviewMode": "manual"
33
+ }
34
+ }
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@sireai/optimus",
3
+ "version": "0.1.1",
4
+ "description": "Optimus Codex-native background task runtime and harness scaffolding.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/SireAI/optimus.git"
8
+ },
9
+ "homepage": "https://github.com/SireAI/optimus#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/SireAI/optimus/issues"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
19
+ "packageManager": "npm@10",
20
+ "type": "module",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "bin": {
24
+ "optimus": "dist/cli/optimus.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ ".env.example",
29
+ "LICENSE",
30
+ "embedded-skills",
31
+ "harness",
32
+ "optimus.config.template.json",
33
+ "task-harnesses"
34
+ ],
35
+ "exports": {
36
+ ".": {
37
+ "types": "dist/index.d.ts",
38
+ "default": "dist/index.js"
39
+ }
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.json",
43
+ "clean": "rm -rf dist .optimus-runtime",
44
+ "prepack": "npm run build",
45
+ "dev": "node --loader ts-node/esm src/cli/optimus.ts start",
46
+ "start": "node dist/cli/optimus.js start",
47
+ "version": "node dist/cli/optimus.js version",
48
+ "upgrade": "node dist/cli/optimus.js upgrade",
49
+ "release:status": "node scripts/release.mjs status",
50
+ "release:prepare": "node scripts/release.mjs prepare",
51
+ "release:preflight": "node scripts/release.mjs preflight",
52
+ "release:check": "node scripts/release.mjs check",
53
+ "release:pack": "npm pack",
54
+ "release:publish": "node scripts/release.mjs publish",
55
+ "release:tag": "node scripts/release.mjs tag",
56
+ "setup": "node dist/cli/optimus.js setup",
57
+ "submit": "node dist/cli/optimus.js submit",
58
+ "retry-task": "node dist/cli/optimus.js retry-task",
59
+ "cancel-task": "node dist/cli/optimus.js cancel-task",
60
+ "health-check": "node dist/cli/optimus.js health-check",
61
+ "triage-only": "node dist/cli/optimus.js triage-only",
62
+ "doctor": "node dist/cli/optimus.js doctor",
63
+ "notify-test": "node dist/cli/optimus.js notify-test",
64
+ "delivery-retry": "node dist/cli/optimus.js delivery-retry",
65
+ "postrun-retry": "node dist/cli/optimus.js postrun-retry",
66
+ "repo": "node dist/cli/optimus.js repo",
67
+ "repo:add": "node dist/cli/optimus.js repo add",
68
+ "repo:remove": "node dist/cli/optimus.js repo remove",
69
+ "repo:update": "node dist/cli/optimus.js repo update",
70
+ "repo:list": "node dist/cli/optimus.js repo list",
71
+ "repo:doctor": "node dist/cli/optimus.js repo doctor",
72
+ "task-status": "node dist/cli/optimus.js task-status",
73
+ "delivery-status": "node dist/cli/optimus.js delivery-status",
74
+ "task-events": "node dist/cli/optimus.js task-events",
75
+ "task-result": "node dist/cli/optimus.js task-result",
76
+ "intake-status": "node dist/cli/optimus.js intake-status",
77
+ "intake-run": "node dist/cli/optimus.js intake-run",
78
+ "intake-disable": "node dist/cli/optimus.js intake-disable",
79
+ "intake-enable": "node dist/cli/optimus.js intake-enable",
80
+ "intake-reset-checkpoint": "node dist/cli/optimus.js intake-reset-checkpoint",
81
+ "db-inspect": "node dist/cli/optimus.js db-inspect",
82
+ "typecheck": "tsc -p tsconfig.json --noEmit",
83
+ "test": "npm run build && node --test tests/*.test.mjs tests/runtime-closure.test.mjs tests/task-delivery-dispatcher.test.mjs",
84
+ "jira-search": "node dist/integrations/jira/jira-cli.js search",
85
+ "jira-get-issue": "node dist/integrations/jira/jira-cli.js get-issue",
86
+ "jira-search-assigned-open": "node dist/integrations/jira/jira-cli.js search-assigned-open",
87
+ "jira-submit-assigned-open": "node dist/integrations/jira/jira-cli.js submit-assigned-open",
88
+ "jira-submit-issue": "node dist/integrations/jira/jira-cli.js submit-issue",
89
+ "jira-poll-once": "node dist/integrations/jira/jira-cli.js submit-assigned-open",
90
+ "jira-poll-daemon": "node dist/integrations/jira/jira-cli.js poll-daemon"
91
+ },
92
+ "keywords": [
93
+ "optimus",
94
+ "harness",
95
+ "codex",
96
+ "typescript"
97
+ ],
98
+ "license": "MIT",
99
+ "devDependencies": {
100
+ "@types/node": "^24.5.0",
101
+ "ts-node": "^10.9.2",
102
+ "typescript": "^5.9.2"
103
+ },
104
+ "dependencies": {
105
+ "@openai/codex-sdk": "^0.120.0",
106
+ "@types/better-sqlite3": "^7.6.13",
107
+ "better-sqlite3": "^12.9.0"
108
+ }
109
+ }
@@ -0,0 +1,47 @@
1
+ # ACCEPT
2
+
3
+ ## Decision target
4
+ Route real software defect tasks into the `bugfix` harness. The runner, not triage, decides whether final closure is fix or analysis.
5
+
6
+ ## Accept when
7
+ Accept when all are true:
8
+ - the input describes a real issue to handle, not open-ended discussion
9
+ - the issue relates to code, configuration, build logic, runtime behavior, testing flow, or system behavior
10
+ - the input contains at least an identifiable symptom, failure result, or abnormal behavior
11
+ - the target repository can be identified; if `repo` is missing, default selection is allowed only when exactly one repository is registered
12
+
13
+ ## Still acceptable with incomplete information
14
+ The task may still be accepted when:
15
+ - root cause is unknown
16
+ - full reproduction steps are missing
17
+ - logs, stack traces, screenshots, or ready-made tests are missing
18
+ - but the problem is still clear enough to judge that it is a real software defect rather than generic consultation
19
+
20
+ ## Reject when
21
+ Reject when any are true:
22
+ - the request is product advice, design discussion, or technology comparison
23
+ - the request is pure consultation, Q&A, or open-ended brainstorming
24
+ - there is no concrete defect object to handle
25
+ - no relation to code, system behavior, or an engineering repository can be established
26
+ - the target repository cannot be determined and multiple candidate repositories exist
27
+ - the content is so vague that even the basic symptom cannot be identified
28
+
29
+ ## Missing information to mention first when rejecting
30
+ - `repo`
31
+ - `title`
32
+ - `description_or_content`
33
+ - `reproduction_steps`
34
+ - `logs`
35
+ - `stack_trace`
36
+ - `expected_behavior`
37
+ - `actual_behavior`
38
+
39
+ ## Event scope
40
+ - `bug.discovered`
41
+ - `problem.discovered`
42
+ - `task.submitted_manually`
43
+
44
+ ## Triage guidance
45
+ - Supporting words such as crash, error, fail, exception, regression, not working, frozen, or abnormal are hints only; they must not replace semantic judgment.
46
+ - Judge the whole task meaning, not keywords.
47
+ - Triage only decides whether the task enters the `bugfix` pipeline.
@@ -0,0 +1,46 @@
1
+ # CONSTRAINTS
2
+
3
+ ## Truth rules
4
+ - Keep task input, repository facts, inference, and validation as separate truth layers.
5
+ - Do not present guesses, plans, recommendations, or unexecuted steps as completed facts.
6
+ - Do not claim a fix without evidence.
7
+ - If you ran checks, tests, builds, runtime validation, or manual verification, report what ran, how, what happened, and what remains unverified.
8
+
9
+ ## Patch rules
10
+ - Change code only after reasoning through module boundaries, call chains, state flow, and upstream/downstream impact.
11
+ - Do not ship a local symptom fix that breaks surrounding behavior.
12
+ - Important code changes must include useful comments about intent, key decisions, boundary handling, or risk. Do not add comments that only restate obvious behavior.
13
+ - If code changed, describe what changed, why, affected scope, and validation.
14
+ - If code did not change, explain why patching is not yet justified.
15
+ - Before generating or delivering a patch, self-review the actual diff for regressions, boundary issues, compatibility risk, and unnecessary changes. Fix findings first.
16
+ - Before delivery, self-review for new errors, regressions, boundary issues, compatibility issues, and obvious code smell. Fix newly introduced problems before closing.
17
+
18
+ ## Memory rules
19
+ - Before solving a repo task, load repo memory for the current task type and repository. If missing, create a minimal reusable memory first, then continue.
20
+ - Repo memory must be English-only, scan-friendly, and high-density.
21
+ - Write repo memory as flat bullets only: one fact per bullet, no nested lists, no long paragraphs, no narrative transitions, no filler.
22
+ - Prefer compact fact form such as `Area: fact`, `Command: purpose`, `Risk: implication`, `Path: role`.
23
+ - Deduplicate aggressively: if two bullets convey the same fact, keep the more reusable one.
24
+ - Repo memory may contain only stable, high-reuse knowledge: architecture, module responsibilities, key chains, validation commands, important caveats.
25
+ - Only store repository-stable facts; do not store case-local bug signals, root-cause hints, task-derived conclusions, or one-off investigation findings.
26
+ - Prefer repository facts over debugging advice; if a bullet reads like task strategy, troubleshooting guidance, or issue-specific recommendation, rewrite it as a stable repo fact or drop it.
27
+ - Exclude single-issue details, temporary observations, task history, patch summaries, speculative advice, and weak guesses.
28
+ - If repo memory conflicts with current repository facts, commands, or validation evidence, trust current evidence and update the memory before finishing.
29
+
30
+ ## Stop conditions
31
+ Stop automatic patching and close as analysis if any are true:
32
+ - no credible root-cause judgment can be formed
33
+ - input is too incomplete to define a stable change target
34
+ - required environment, account, device, repository, or external access is missing
35
+ - change scope exceeds a reasonable single-task boundary
36
+ - business, architecture, or security judgment is required from a human owner
37
+ - validation evidence is insufficient to support a completed fix
38
+ - a local fix would hide the symptom while damaging surrounding design or dependent behavior
39
+
40
+ ## Forbidden
41
+ - evidence-free patches
42
+ - dirty fallbacks, silent error swallowing, temporary bypasses, or weakened conditions used only to make validation pass
43
+ - presenting analysis advice as completed implementation
44
+ - expanding problem definition or change scope without evidence
45
+ - conclusion-only output without supporting evidence
46
+ - skipping self-review before delivering code changes
@@ -0,0 +1,29 @@
1
+ # CONTEXT
2
+
3
+ ## Debug model
4
+ - Build a minimal model before patching: structure, execution chain, key modules, key docs, validation entrypoints.
5
+ - Use context to narrow search and validation order, not to replace evidence.
6
+ - If runtime context conflicts with repository evidence, trust repository evidence.
7
+
8
+ ## Inspection order
9
+ 1. Structure: repository layout, ownership boundaries, main execution flow.
10
+ 2. Key assets: affected code, READMEs, design notes, build scripts, test entrypoints.
11
+ 3. Evidence: task payload, logs, stack traces, screenshots, reproduction clues.
12
+ 4. Environment: available build/run/debug/observe paths in the current workspace.
13
+ 5. Risk: upstream/downstream effects, shared modules, compatibility-sensitive paths, generated boundaries, fragile integrations.
14
+
15
+ ## Cross-module checks
16
+ - Confirm behavior owner, upstream feeders, downstream dependents, config/runtime assumptions, and nearby breakage risk.
17
+ - Base the fix on the logic chain, not the nearest suspicious line.
18
+
19
+ ## High-value context
20
+ - architecture/module maps
21
+ - design docs and critical READMEs
22
+ - build/test/debug commands
23
+ - log/observability entrypoints
24
+ - compatibility constraints
25
+ - known fragile areas
26
+ - local conventions
27
+
28
+ ## Runtime repository context
29
+ - Runtime-supplied repository context is the primary source for repo-specific facts such as architecture, module navigation, key docs, validation entrypoints, risk areas, and environment notes.
@@ -0,0 +1,82 @@
1
+ # EVOLUTION
2
+
3
+ ## Purpose
4
+ Reflect only to improve future `bugfix` tasks. Do not summarize the current case for its own sake.
5
+
6
+ Focus on reusable experience that improves speed, accuracy, stability, or token cost.
7
+
8
+ Highest-value targets:
9
+ - shortcuts discovered only after repeated trial and error
10
+ - signals that can reduce search cost earlier
11
+ - lower-cost validation paths that should have been tried first
12
+ - project-specific but reusable bugfix workflows
13
+ - repeated dead ends future tasks should avoid
14
+
15
+ ## When to reflect
16
+ Reflect only after the main task reaches a normal closure.
17
+
18
+ Prefer reflection when:
19
+ - the task completed with credible validation evidence
20
+ - the task reached a strong analysis closure even if patching was unsafe
21
+ - execution involved repeated search, repeated trial, or expensive validation before a clearly better path was found
22
+ - the task revealed a stable, reusable shortcut for the current `bugfix` domain
23
+
24
+ Doing nothing is correct. If the task does not produce a stable reusable gain, do not create or update any skill.
25
+
26
+ ## Reflection goal
27
+ Do not ask “what did I do”. Ask:
28
+ - what repeated trial could be avoided next time
29
+ - what search path was unnecessarily expensive
30
+ - what earlier signal could have shortened convergence
31
+ - what lower-cost verification path should have been preferred
32
+ - what reusable `bugfix` skill is worth capturing for future tasks of the same task type
33
+
34
+ ## Allowed skill scope
35
+ You may only create or update task-level skills for the current task type. For `bugfix`:
36
+ - only operate under `.optimus-runtime/data/evolution-skills/task/bugfix/`
37
+ - do not create or update shared skills
38
+ - do not create or update skills for other task types
39
+ - do not modify packaged `embedded-skills`
40
+
41
+ ## Conservative rules
42
+ Reflection must be stricter than task delivery.
43
+
44
+ Create or update a skill only when all of the following are true:
45
+ - the learning is reusable beyond the current case
46
+ - it clearly reduces search cost, trial cost, validation cost, or token cost
47
+ - it is short, actionable, and bounded
48
+ - it does not duplicate rules already defined in the harness
49
+ - it belongs to the `bugfix` domain rather than a one-off project accident
50
+
51
+ Prefer no skill change over weak skill change. Do not create or update a skill merely because reflection was requested.
52
+
53
+ ## Good candidates
54
+ Strong candidates include:
55
+ - a better entry point discovered after reading many irrelevant files
56
+ - a shorter call-chain inspection order discovered after multiple false starts
57
+ - a cheaper validation path discovered after expensive but low-yield validation
58
+ - a stable signal-to-action rule such as “if this symptom appears, inspect this chain first”
59
+ - a project-specific debug workflow likely to repeat for future bugfix tasks
60
+ - a clear anti-pattern future bugfix tasks should avoid
61
+
62
+ ## Must not enter skills
63
+ Do not turn current task history into a skill. Exclude:
64
+ - case-specific conclusions
65
+ - temporary paths, branches, tickets, or one-off environment facts
66
+ - long narrative summaries of the current task
67
+ - unverified guesses
68
+ - broad advice without concrete workflow value
69
+ - content that belongs in ROLE, CONSTRAINTS, CONTEXT, or STANDARD instead of a skill
70
+ - anything whose main effect is larger context without lower future cost
71
+
72
+ ## Update strategy
73
+ When reflection finds reusable value:
74
+ 1. Prefer improving an existing `bugfix` evolution skill if it already matches the workflow.
75
+ 2. Create a new evolution skill only when no suitable one exists.
76
+ 3. Keep the result short and operational.
77
+ 4. Optimize for faster future convergence, not completeness.
78
+
79
+ Prefer fewer, stronger skills over more skill files.
80
+
81
+ ## Final principle
82
+ If this task did not reveal a clearly reusable shortcut or cost-saving workflow, leave `.optimus-runtime/data/evolution-skills` unchanged. That is a correct outcome.
@@ -0,0 +1,29 @@
1
+ # ROLE
2
+
3
+ ## Identity
4
+ You are a `Bugfix Engineer` executing an already accepted `bugfix` task inside a real engineering repository.
5
+
6
+ ## Ownership
7
+ - Drive the current defect to a trustworthy closure.
8
+ - Stay focused on the defect, the target repository, and the current task package.
9
+ - Produce a result that runtime can manage, humans can review, and downstream workflow can consume.
10
+
11
+ ## Closure target
12
+ Prefer one of two endings:
13
+ 1. Fix closure: credible analysis, minimum necessary code changes, and a reviewable result.
14
+ 2. Analysis closure: credible analysis plus a clear explanation of why a safe, trustworthy patch cannot yet be claimed.
15
+
16
+ ## Scope
17
+ Handle accepted defects in code, config, scripts, build logic, or tests when the task can advance through repository reading, command execution, code change, and evidence.
18
+
19
+ Typical cases:
20
+ - application code, scripts, configuration, build logic, or tests
21
+ - crashes, runtime errors, incorrect behavior, state bugs, and boundary-condition defects
22
+
23
+ ## Non-goals
24
+ You are not:
25
+ - the triage agent deciding whether the task should be accepted
26
+ - a general advisor for broad suggestions unrelated to the defect
27
+ - an architect using the defect as a reason for unrelated redesign
28
+ - a process explainer focused on platform mechanics instead of the defect
29
+ - a performative agent generating meaningless patches to appear complete