@comento/pota-harness 0.0.0-stage → 1.0.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 (99) hide show
  1. package/.agents/workflows/pota-doctor.md +16 -0
  2. package/.agents/workflows/pota-install.md +15 -0
  3. package/.agents/workflows/pota-memory.md +17 -0
  4. package/.agents/workflows/pota-plan.md +22 -0
  5. package/.agents/workflows/pota-review.md +16 -0
  6. package/.agents/workflows/pota-toolcheck.md +9 -0
  7. package/.agents/workflows/pota-uninstall.md +9 -0
  8. package/.agents/workflows/pota-upgrade.md +15 -0
  9. package/.agents/workflows/pota-work.md +24 -0
  10. package/.claude/agents/explorer.md +7 -0
  11. package/.claude/agents/worker.md +7 -0
  12. package/.claude/commands/pota-doctor.md +5 -0
  13. package/.claude/commands/pota-install.md +9 -0
  14. package/.claude/commands/pota-memory.md +5 -0
  15. package/.claude/commands/pota-plan.md +5 -0
  16. package/.claude/commands/pota-review.md +5 -0
  17. package/.claude/commands/pota-toolcheck.md +7 -0
  18. package/.claude/commands/pota-uninstall.md +5 -0
  19. package/.claude/commands/pota-upgrade.md +9 -0
  20. package/.claude/commands/pota-work.md +7 -0
  21. package/.codex-plugin/plugin.json +33 -0
  22. package/LICENSE +21 -0
  23. package/README.de.md +166 -0
  24. package/README.es.md +166 -0
  25. package/README.fr.md +166 -0
  26. package/README.ja.md +166 -0
  27. package/README.ko.md +184 -0
  28. package/README.md +191 -2
  29. package/README.pt.md +166 -0
  30. package/README.zh.md +166 -0
  31. package/agents/explorer.md +36 -0
  32. package/agents/worker.md +45 -0
  33. package/commands/pota-doctor.md +28 -0
  34. package/commands/pota-install.md +29 -0
  35. package/commands/pota-memory.md +17 -0
  36. package/commands/pota-plan.md +22 -0
  37. package/commands/pota-review.md +16 -0
  38. package/commands/pota-toolcheck.md +17 -0
  39. package/commands/pota-uninstall.md +27 -0
  40. package/commands/pota-upgrade.md +26 -0
  41. package/commands/pota-work.md +24 -0
  42. package/docs/model-guidance/README.md +67 -0
  43. package/docs/model-guidance/claude.md +49 -0
  44. package/docs/model-guidance/codex.md +68 -0
  45. package/hooks/hooks.json +65 -0
  46. package/package.json +47 -4
  47. package/scripts/pota +14 -0
  48. package/scripts/pota-auto-upgrade.mjs +342 -0
  49. package/scripts/pota-cleanup.mjs +194 -0
  50. package/scripts/pota-goal-cli.mjs +337 -0
  51. package/scripts/pota-goal-evidence.mjs +186 -0
  52. package/scripts/pota-goal-history.mjs +316 -0
  53. package/scripts/pota-goal-operations-evidence.mjs +213 -0
  54. package/scripts/pota-goal-operations-mutations.mjs +97 -0
  55. package/scripts/pota-goal-operations.mjs +281 -0
  56. package/scripts/pota-goal-policy.mjs +62 -0
  57. package/scripts/pota-goal-state-validation.mjs +361 -0
  58. package/scripts/pota-goal-state.mjs +136 -0
  59. package/scripts/pota-goal.mjs +69 -0
  60. package/scripts/pota-index.mjs +1052 -0
  61. package/scripts/pota-lifecycle-claude.mjs +173 -0
  62. package/scripts/pota-lifecycle-commands.mjs +418 -0
  63. package/scripts/pota-lifecycle-config.mjs +153 -0
  64. package/scripts/pota-lifecycle-hosts.mjs +98 -0
  65. package/scripts/pota-lifecycle-integrity.mjs +272 -0
  66. package/scripts/pota-lifecycle-layout.mjs +52 -0
  67. package/scripts/pota-lifecycle-lock.mjs +205 -0
  68. package/scripts/pota-lifecycle-mirror.mjs +83 -0
  69. package/scripts/pota-lifecycle-staging.mjs +156 -0
  70. package/scripts/pota-lifecycle-transaction-journal.mjs +244 -0
  71. package/scripts/pota-lifecycle-transaction-targets.mjs +119 -0
  72. package/scripts/pota-lifecycle-transaction.mjs +12 -0
  73. package/scripts/pota-lifecycle.mjs +244 -0
  74. package/scripts/pota-paths.mjs +190 -0
  75. package/scripts/pota-safe-fs.mjs +277 -0
  76. package/scripts/pota-state-context.mjs +281 -0
  77. package/scripts/pota-state-hook.mjs +26 -0
  78. package/scripts/pota-state-init.mjs +80 -0
  79. package/scripts/pota-state.mjs +245 -0
  80. package/scripts/pota-toolcheck-detect.mjs +229 -0
  81. package/scripts/pota-toolcheck-runtime.mjs +178 -0
  82. package/scripts/pota-toolcheck.mjs +221 -0
  83. package/scripts/pota-update-state.mjs +219 -0
  84. package/scripts/pota.mjs +200 -0
  85. package/skills/pota-memory/SKILL.md +52 -0
  86. package/skills/pota-plan/SKILL.md +66 -0
  87. package/skills/pota-plan/delegation.md +65 -0
  88. package/skills/pota-plan/heavy-path.md +28 -0
  89. package/skills/pota-plan/planning-rules.md +78 -0
  90. package/skills/pota-review/SKILL.md +56 -0
  91. package/skills/pota-work/SKILL.md +71 -0
  92. package/skills/pota-work/delegation.md +65 -0
  93. package/skills/pota-work/heavy-path.md +18 -0
  94. package/skills/pota-work/recovery.md +29 -0
  95. package/skills/pota-work/verification.md +79 -0
  96. package/templates/MEMORY.md +12 -0
  97. package/templates/PLAN.md +9 -0
  98. package/templates/domain-memory.md +22 -0
  99. package/templates/work-plan.md +177 -0
@@ -0,0 +1,26 @@
1
+ # pota-upgrade
2
+
3
+ Goal: update the Pota installation from the current source.
4
+
5
+ Run from the published or global package, not from the installed cache copy:
6
+
7
+ ```sh
8
+ bunx @comento/pota-harness@latest upgrade
9
+ bunx @comento/pota-harness@latest upgrade --hosts codex,claude
10
+ ```
11
+
12
+ The current custom marketplace lifecycle remains in use. An installed copy (`~/.pota/install/` or the Codex plugin cache) is a replacement target and must not upgrade itself.
13
+
14
+ Actions:
15
+
16
+ - Replace only files tracked by the ownership manifest whose current digest still matches the installed digest.
17
+ - Recompute Pota-owned hook trust state without rewriting public feature or agent settings.
18
+ - Replace owned Claude Code and Antigravity mirror files with the latest content.
19
+ - Refresh runtime locators for every installed surface.
20
+ - Stage and validate all candidates before commit; rollback committed phases in reverse order on failure.
21
+ - Preserve and report a conflict for modified or unmanaged artifacts.
22
+ - Keep the recorded hosts unless `--hosts` (`all` or a comma list of `codex`, `claude`, `antigravity`) changes them; deselected hosts are removed, and a modified artifact of a deselected host refuses the upgrade.
23
+ - After a version change, keep the previous canonical runtime and Codex cache copy for 3 days (at most 3 of each); expired ones are removed by the next install or upgrade. A Codex cache copy at or above the new version is never kept, because Codex loads the highest cached version.
24
+ - When the Claude Code plugin cache holds a different version, run `claude plugin marketplace update pota` and `claude plugin update pota@pota --scope user`. If that fails, keep the upgraded files, print those commands, and exit 1.
25
+ - Refuse, changing nothing, when the installed version is newer than this CLI; `--allow-downgrade` moves the installation to this CLI's version anyway.
26
+ - `upgrade --auto` is reserved for the auto-upgrade runner; it keeps the recorded hosts, never downgrades (it cannot be combined with `--allow-downgrade`), and refuses to run without an existing installation.
@@ -0,0 +1,24 @@
1
+ # pota-work
2
+
3
+ Use the `pota-work` skill.
4
+
5
+ Prerequisite: resolve the installed Pota runtime from the plugin or skill locator. If the shared runtime or locator is missing, unreadable, or inconsistent, stop every dependent mirror; run published/global `pota doctor`, then `pota upgrade` to recover it. Never repair through another mirror or look for Pota scripts or model guidance in the target repository.
6
+
7
+ Goal: execute the active goal's current task without bypassing complexity triage, then keep advancing tasks until goal-level final review completes or the goal is explicitly paused, blocked, or cancelled. Quick Path work has no plan or goal: implement, run one focused check plus the project's normal check, and report; escalate to Light Path (plan + goal) before further edits if any Quick Path criterion fails.
8
+
9
+ Record the code checkpoint after exact file/caller/test inspection immediately before the first edit. After editing begins, a new Heavy Path signal promotes Light Path to Heavy Path: stop further edits, mark affected evidence stale, synchronize the plan artifact, `goal replan` roadmap, and native UI plan, and repeat the code checkpoint. Choose each task's model by its nature (fast, balanced, stronger, strongest) and pass it with effort through the host option; request Light `medium`, Heavy `high`, final verification/review `xhigh`.
10
+
11
+ Procedure:
12
+
13
+ 1. Every agent reads project-root `MEMORY.md` when present and continues without repository memory when absent before selecting or executing a task.
14
+ 2. Read `PLAN.md`, the detailed plan, relevant memory notes, and the `pota://` model guidance recorded in the plan through the installed runtime.
15
+ 3. Read the current task with `goal task status`; run `goal ready` and delegate independent ready tasks to parallel workers (same worktree, disjoint `writeScope`). Fold a new request into an unfinished goal with `goal replan` instead of cancelling it. Copy the session-start hook's `Pota CLI:` prefix literally; never store it in a shell variable. `--root` may be omitted when the cwd is inside the repository.
16
+ 4. Confirm tool readiness (installation only with explicit approval) and the recorded route.
17
+ 5. Before implementation, spend reasoning on a focused executable test contract covering requirements, invariants, boundaries, and failure modes. Confirm the intended failure, then give the `worker` the contract, failing evidence, exact file ownership, and constraints and require the minimum change.
18
+ 6. Run module acceptance and surface integration through `goal verify -- ...`; `--kind "moduleAcceptance|surfaceIntegration"` records both from one run. Treat tool exit codes as authoritative and expand context only around failing tests. Heavy Path records explicit `Tests:` evidence.
19
+ 7. Never edit, weaken, skip, or delete existing tests, fixtures, or verification commands to make a gate pass unless the plan records the contract change. Reproduce reported defects before fixing, and after a fix search for other implementations of the same rule or pattern.
20
+ 8. Inspect package lifecycle scripts and run normal `npm pack --dry-run` by default. Content-producing or unknown lifecycle scripts must never use `--ignore-scripts`; only absent or proven content-neutral scripts may use it while the full check remains fresh.
21
+ 9. Relevant mutation makes the current task's evidence stale; rerun it before completing the task. Do not rerun earlier tasks' checks; finish with one goal-level check through `goal finish -- ...`. Missing, failed, skipped, stale, or placeholder evidence never completes work. `goal stats` measures receipt reruns; `goal stats --history` compares finished goals of the repository.
22
+ 10. Read the skill's reference files only when needed: `pota://skills/pota-work/verification.md`, `pota://skills/pota-work/delegation.md`, `pota://skills/pota-work/recovery.md`, and `pota://skills/pota-work/heavy-path.md` (Heavy route only).
23
+ 11. Before `goal finish`, record the memory promotion decision in the plan's Evidence: `Memory promotion: docs/memory/<domain>.md` when the goal produced reusable repository knowledge (write the note with a `Summary:` line, then run `memory index --root <repoRoot>`), otherwise `Memory promotion: none: <reason>`. The line is required and the note is optional: do not create a note when nothing qualifies. Update the plan, goal state, and `PLAN.md` only after evidence exists. Answer side questions briefly and resume unless explicitly asked to pause, stop, or switch.
24
+ 12. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
@@ -0,0 +1,67 @@
1
+ # Model Guidance
2
+
3
+ Pota only applies model-specific adjustment to Claude-family and Codex-family models.
4
+
5
+ The goal is not to make prompts long by model. The goal is to stabilize the same `MEMORY.md`/`PLAN.md` flow according to model strengths.
6
+
7
+ ## Application Order
8
+
9
+ 1. Identify the active model name. If the model name is not directly exposed, infer it from the user's default model setting and agent role frontmatter.
10
+ 2. Resolve this installed guidance root from the active skill's `references/pota-runtime.json` or the source skill's location. Never look for Pota model guidance in the target repository. If the shared runtime or locator is missing, unreadable, or inconsistent, stop using every dependent mirror; run published/global `pota doctor`, then `pota upgrade` for recovery, rather than repairing through another mirror.
11
+ 3. For Claude-family models, apply `pota://docs/model-guidance/claude.md`.
12
+ 4. For Codex-family models, apply `pota://docs/model-guidance/codex.md`.
13
+ 5. If the model is not clearly classified, apply only the common rules and skip model-specific adjustment.
14
+
15
+ ## Common Rules
16
+
17
+ - On every fresh entry, compaction recovery, restart, delegation, or handoff, restore context in this order: optional root `MEMORY.md` → current phase skill → active plan → current-task references → model guidance recorded by the plan. If `MEMORY.md` is absent, continue without repository memory and do not invoke another memory service. If persisted state or an assignment requires another reference that is missing, unreadable, or inconsistent, fail closed: do not edit, delegate, approve, or complete; report or record a blocker. Delegation means the delegated agent restores on its own entry; the orchestrator does not re-read this chain after dispatching or collecting a subagent, and within one unbroken context it rereads only references that changed, which keeps the cached prompt prefix stable.
18
+ - Keep root `MEMORY.md` and `PLAN.md` as indexes only.
19
+ - Keep repository-specific judgment in `docs/memory/` and `docs/plan/`. Keep Pota's model guidance in the installed plugin and reference it with `pota://docs/model-guidance/...`.
20
+ - Treat the user-home `.pota/projects/<project-id>/worktrees/<worktree-id>/state.json` as a worktree-bound active-work slot. State without `worktreeId` and state copied into another worktree are stale and are removed on the next hook/goal start. Successful completion or cancellation removes the owning copy after plan evidence is recorded; only paused or blocked work remains for resumption.
21
+ - Preserve proper nouns, file names, variable names, service names, alert names, MCP tool names, and agent names exactly as written.
22
+ - Select Light Path or Heavy Path before implementation.
23
+ - Treat complexity as three checkpoints: a provisional request checkpoint, a post-exploration planning checkpoint, and a code checkpoint after exact file/caller/test inspection immediately before the first edit. Before editing, evidence may change either route. Every change must synchronize the plan artifact, repository goal task roadmap through `goal replan`, and native UI plan, including reviews and required evidence. After editing begins, a new Heavy signal promotes Light Path to Heavy Path: stop further edits, mark affected evidence stale, synchronize all three roadmaps, and repeat the code checkpoint.
24
+ - Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, and records evidence.
25
+ - Delegate actual implementation edits to `worker` subagents whenever subagent tools are available, regardless of Light Path or Heavy Path.
26
+ - When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; the orchestrator must immediately relay received status events to the user. If no mid-run reporting channel exists, the orchestrator relays observable events such as assignment, waiting, and final completion.
27
+ - When a delegated subagent finishes, require a final report before it leaves; after capturing the final report and evidence, the orchestrator closes or releases the completed subagent, then reviews the final report and evidence before marking the work complete.
28
+ - If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
29
+ - Detect required LSP, typecheck, lint, dry-run, and verification tools before implementation.
30
+ - Missing required tools must be reported with a proposed install. Installation requires explicit user approval and a pinned/supported installer.
31
+ - Treat non-trivial implementation or continuation of planned work as authorization to bind active work to a persisted Pota goal and stable task IDs, even when the user does not mention a goal. Routine known-target Git/GitHub operations (status, fetch, checkout, branch, merge, push, PR management) stay plan/goal-free unless they require code edits, conflict resolution, destructive recovery, release/deploy, or design. For planned work, after MEMORY.md, first write an initial plan that makes triage the active task, synchronize it before exploration, and implement only from the decision-complete revision. Exclude consultation, explanation, and plan-only requests. Quick Path changes (criteria in `pota-plan`) need no plan or goal and escalate to Light Path before further edits when a criterion fails.
32
+ - Treat missing, failed, skipped, stale, or placeholder evidence as failure. Task evidence records must be bound to the current goal, task, and plan.
33
+ - Treat the repository Pota state as the fail-closed transition authority. Advance the matching Codex UI plan step only after the evidence-gated repository task transition succeeds.
34
+ - Spend reasoning on a focused executable test contract before implementation: requirements, invariants, boundaries, and failure modes. Give implementation only that contract, failing evidence, file scope, and constraints; require the minimum passing change.
35
+ - Run verification through `goal verify -- ...`; its default timeout is 600,000 ms and its maximum is 3,600,000 ms. Treat tool exit codes and bounded machine summaries as authoritative. Record evidence only when the starting goal/task identity and pre/post watched fingerprint still match, and choose the watch set and command at the semantic boundary that proves the claim. The default Git fingerprint excludes ignored files; explicitly pass every ignored artifact needed by the claim with `--watch`. Compress success output and expand context only for failing tests and related code.
36
+ - Use a verification ladder: focused contract tests, one full check after the final change, then package dry-run while the full check remains fresh. Inspect package lifecycle scripts first and run normal `npm pack --dry-run` by default. Content-producing or unknown lifecycle scripts must never use `--ignore-scripts`; only absent or proven content-neutral scripts may use it. Do not rerun earlier tasks' checks after later edits; finish with one goal-level check through `goal finish -- <argv>`.
37
+ - Every implementation task must pass module acceptance verification and surface integration verification.
38
+ - Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
39
+ - Limit each task to two verification passes by default. After two failed passes, record the blocker or split it into sub-tasks instead of continuing a repeated loop.
40
+ - User-visible responses and generated or updated documentation, plans, and memory artifacts must follow the OS locale unless the user asks for another language.
41
+
42
+ ## Prompt Cache Shape
43
+
44
+ - Keep `.codex-plugin/plugin.json` `defaultPrompt` as a small, stable policy and recovery kernel. Put detailed bootstrap, delegation, test, package, and verification procedures in the phase skills and this installed guidance.
45
+ - Put static instructions before dynamic goal data. Hook capsules must be deterministic for the same locale, event, and persisted state; prompt text and turn IDs must not change their content.
46
+ - Idle capsules reference root `MEMORY.md` and `pota-plan`; active-work capsules reference the active plan, current task, and `pota-work`; all-tasks-complete capsules reference `pota-review`.
47
+ - A foreign session receives only a generic ownership-conflict capsule on session/prompt events. It must not expose goal, plan, or task details, and it must not make stop hooks block work owned by another session.
48
+ - Character budgets are regression proxies for cache-friendly prompt shape, not measurements of provider cache hits or cost. Pota does not require provider cache keys, breakpoints, or live API telemetry.
49
+ - Do not add read receipts that claim model attention. Restore references on every re-entry and use readable state plus fresh bound evidence as the enforceable contract.
50
+
51
+ ## Model and Reasoning Effort Routing
52
+
53
+ - The plan decides each task's model from its nature and records `Requested model` and `Effective model`; models are not always inherited. Tiers: fast = read-only exploration, search, inventory, summarization (Claude Code `haiku`); balanced = Light Path implementation and routine verification (`sonnet`); stronger = planning, complexity triage, Heavy Path implementation, review, and final verification/review (`opus`); strongest = Heavy Path design only (`fable`), run as a separate `kind: "design"` task dispatched to that tier rather than part of planning. Antigravity `invoke_subagent` `Model` accepts only a tier enum (fast `flash_lite`, balanced `flash`, stronger `pro`, strongest `pro`; no tier above `pro`) and has no effort option, so Effective reasoning effort is `inherited`. Codex slugs: fast `gpt-6-luna`, balanced `gpt-6.1-terra`, stronger `gpt-6-sol`, strongest `gpt-6-astra`.
54
+ - Model Effective: the passed value plus the exact model ID the worker reports from its own system prompt (e.g. `fable (claude-fable-5-1)`; `<value> (unreported)` when absent, never guess; `goal assign --effective-model <id|unreported>`); not passed is `not-applied: <reason>`; `inherited` only when the host has no model option. If a lower-tier worker fails a gate, re-dispatch that task one tier up (fast, balanced, stronger, strongest) before recording a blocker. A subagent's model and effort are fixed at dispatch; any re-dispatch that changes either (one tier up, Light → Heavy promotion, route-change recalculation) MUST be a new dispatch (Claude Code: a new Agent call), never `SendMessage` to the existing subagent. A design model that is not the host's strongest tier (`--host claude-code` `fable`, `codex` `gpt-6-astra`, `antigravity` `pro`; any of the three when `--host` is omitted) fails completion unless `--allow-no-design-model <reason>`.
55
+ - Routing is per dispatch only; never change model or global/user config files. `Model routing: inherited` in `MEMORY.md` or the plan disables per-task selection.
56
+ - Light Path planning, implementation, and verification request `medium`.
57
+ - Heavy Path planning, review, and implementation request `high`; final verification and review request `xhigh`.
58
+ - Every plan task records `Requested reasoning effort` and `Effective reasoning effort`. Requested is Pota's desired profile; Effective is the value confirmed by the dispatch result.
59
+ - Every new task/worker dispatch MUST pass the task's requested effort through the host-exposed reasoning-effort option or host-native equivalent (Claude Code: Agent tool `effort`; `fork` ignores `model` and `effort`). Pass the chosen model the same way (Claude Code: Agent tool `model`). Recording without passing is a defect.
60
+ - Effective is the requested value when the dispatch passed it and the host did not reject it, `not-applied: <reason>` when it was not passed, and `inherited` only when the host exposes no effort option. Describe host capability only from an exposed interface or dispatch result, and distinguish Pota's choice not to integrate or use an option from host non-support. Do not change the model or global config and do not silently choose a nearby value.
61
+ - A route change synchronizes the plan artifact, repository goal task roadmap through `goal replan`, native UI plan, and reasoning effort profile before edits resume. Preserve completed task profiles as audit history and recalculate incomplete task profiles for the new path.
62
+
63
+ ## Delegation Defaults
64
+
65
+ - `explorer`: use for read-only codebase discovery, impact analysis, pattern searches, and read-only verification when available.
66
+ - `worker`: use for actual implementation edits or verification tasks with clear file ownership.
67
+ - Main session: orchestrate, immediately relay received subagent status events or observable subagent lifecycle events to the user, verify, and record evidence; keep only urgent non-implementation blocking work local when the next step depends immediately on the result, except that unavailable subagent tools make the main agent take over implementation directly.
@@ -0,0 +1,49 @@
1
+ # Claude Model Guidance
2
+
3
+ Claude-family models are strong at long-context retention, policy interpretation, and plan consistency review. In Pota, use those strengths for planning, policy interpretation, and evidence review.
4
+
5
+ ## Use Strengths
6
+
7
+ - Read policies across multiple documents and summarize conflicts.
8
+ - Judge domain boundaries, risk, rollback ability, and user impact.
9
+ - Check whether required LSP, typecheck, lint, dry-run, and verification tools were discovered and bootstrapped.
10
+ - Check whether `docs/plan/<topic>.md` is decision-complete.
11
+ - After implementation, confirm that evidence actually satisfies the plan's completion criteria.
12
+
13
+ ## Adjustment Rules
14
+
15
+ - Do not bloat plans with long explanations. Keep decisions, rationale, and evidence.
16
+ - Preserve frequency words such as "all", "each", and "required". Do not handle only the first item and stop.
17
+ - Do not accept "tool missing" as a reason to skip precise codebase exploration until install or bootstrap has been attempted.
18
+ - Do not skip the two verification gates even on Light Path.
19
+ - Do not approve a plan that lacks dry-run or check evidence for external-state-changing work.
20
+ - Do not allow open-ended verification loops. Require a blocker or sub-task split after two failed passes.
21
+ - Choose the model per task (fast `haiku`, balanced `sonnet`, stronger `opus`: planning, triage, Heavy implementation, review, final verification/review; strongest `fable`: Heavy design only, as a separate `kind: "design"` task dispatched to that tier rather than part of planning) and record `Requested model`/`Effective model`; Effective is the passed value plus the exact model ID the worker reports from its own system prompt (`<value> (unreported)` when absent, never guess), `not-applied: <reason>`, or `inherited` when the host has no model option. Re-dispatch one tier up (fast, balanced, stronger, strongest) if a lower-tier worker fails a gate. A subagent's model and effort are fixed at dispatch; any re-dispatch that changes either (one tier up, Light → Heavy promotion, route-change recalculation) MUST be a new dispatch (Claude Code: a new Agent call), never `SendMessage` to the existing subagent. A design model that is not the host's strongest tier (`--host claude-code` `fable`, `codex` `gpt-6-astra`, `antigravity` `pro`; any of the three when `--host` is omitted) fails completion unless `--allow-no-design-model <reason>`. `Model routing: inherited` disables this. `Requested reasoning effort` is Pota's desired profile; `Effective reasoning effort` is what the dispatch response confirms. Every new task/worker dispatch MUST pass the task's requested effort through the host option together with the chosen model; recording without passing is a defect. Effective is the requested value when the dispatch passed it and the host did not reject it, `not-applied: <reason>` when it was not passed, and `inherited` only when the host exposes no effort option. Infer capability only from the exposed interface or dispatch response, distinguish Pota non-integration from host non-support, and change no global/user configuration.
22
+ - In Claude Code, pass model with the Agent tool `model` parameter (`haiku|sonnet|opus|fable`) and effort with `effort` (`low|medium|high|xhigh|max`, same as Pota values), for example `{"description": "Implement task-1", "subagent_type": "general-purpose", "model": "sonnet", "effort": "medium", "prompt": "..."}`. `subagent_type: "fork"` ignores `model` and `effort`; never dispatch routed work as a fork.
23
+ - On Heavy Path, check plan gaps before implementation.
24
+ - Review all three complexity records: the provisional request checkpoint, post-exploration planning checkpoint, and code checkpoint after exact file/caller/test inspection immediately before the first edit. Before editing, evidence may change either route. Every change must synchronize the plan artifact, repository goal task roadmap through `goal replan`, and native UI plan, including reviews and required evidence. After editing begins, a new Heavy signal promotes Light Path to Heavy Path: stop further edits, mark affected evidence stale, synchronize all three roadmaps, and repeat the code checkpoint.
25
+ - Before asking the user, use repository evidence and available `explorer`/`worker` delegation when it materially improves speed or quality.
26
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
27
+
28
+ ## Path Guidance
29
+
30
+ ### Policy And Risk
31
+
32
+ - Summarize domain boundaries and risk from repository evidence.
33
+ - If policy is unclear, propose candidates to record in `docs/memory/<domain>.md`.
34
+ - Clearly name risk signals that require Heavy Path.
35
+
36
+ ### Planning
37
+
38
+ - Keep the plan short and executable.
39
+ - Always record complexity triage and the selected Light/Heavy Path.
40
+ - Always record tool readiness and blockers.
41
+ - Each module task must include files, contract, dry-run or check command when applicable, module acceptance verification, and surface integration verification.
42
+
43
+ ### Review
44
+
45
+ - Lead with findings.
46
+ - Do not approve without evidence.
47
+ - Check that missing tools have install-attempt evidence before approving a fallback.
48
+ - Check that dry-run or check evidence exists when external state could change.
49
+ - Prioritize proper noun preservation, plan scope drift, and missing verification.
@@ -0,0 +1,68 @@
1
+ # Codex Model Guidance
2
+
3
+ Codex-family models are strong at small implementation tasks, explicit tool use, and repeatable verification. In Pota, prefer them for bounded `worker` tasks and structurally clear planning. When Codex is the user-called/main agent, it orchestrates instead of making implementation edits directly whenever subagent tools are available.
4
+
5
+ ## Use Strengths
6
+
7
+ - Quickly handle implementation tasks with clear file scope.
8
+ - As `worker`, make actual implementation edits within the assigned file scope.
9
+ - As the user-called/main agent, delegate implementation edits to `worker` whenever subagent tools are available.
10
+ - As a subagent, report status to the orchestrator when the current subagent tool provides a progress-reporting channel, including when starting work, when deciding or confirming direction, during periodic progress, and when finishing.
11
+ - As a subagent, provide a final report before leaving when assigned work is complete.
12
+ - Read existing patterns and make minimal changes in the same style.
13
+ - Run repository tool readiness checks and bootstrap missing command-line tools.
14
+ - Capture module acceptance verification and surface integration verification from command results.
15
+ - Run dry-run, check, plan, diff, validate, or equivalent commands before mutating external state.
16
+ - Explore independent work in parallel and sequence only dependent work.
17
+
18
+ ## Adjustment Rules
19
+
20
+ - On every fresh entry, compaction recovery, restart, delegation, or handoff, restore optional root `MEMORY.md` → current phase skill → active plan → current-task references → recorded model guidance. Missing `MEMORY.md` never blocks and must not trigger another memory service. If persisted state or the assignment requires another missing, unreadable, or inconsistent reference, fail closed and report a blocker before editing, delegating, approving, or completing. Delegation means the delegated agent restores on its own entry; the orchestrator does not re-read this chain after dispatching or collecting a subagent, and within one unbroken context it rereads only references that changed, which keeps the cached prompt prefix stable.
21
+ - Do not start implementation without a plan.
22
+ - Choose the model per task by tier (fast, balanced, stronger, strongest) and pass it through the host-native model option as fast `gpt-6-luna`, balanced `gpt-6.1-terra`, stronger `gpt-6-sol`, strongest `gpt-6-astra`; record `Requested model`/`Effective model` (`inherited` when the host exposes no model option). Re-dispatch one tier up if a lower-tier worker fails a gate. `Model routing: inherited` disables this. `Requested reasoning effort` is Pota's desired profile; `Effective reasoning effort` is what the dispatch response confirms. Every new task/worker dispatch MUST pass the task's requested effort through the host's task/subagent option together with the chosen model; recording without passing is a defect. Effective is the requested value when passed and not rejected, `not-applied: <reason>` when not passed, and `inherited` only when the host exposes no effort option. Infer capability only from the exposed interface or dispatch response, distinguish Pota non-integration from host non-support, and change no global/user configuration.
23
+ - Do not treat complexity as a one-time choice. Require the provisional request checkpoint, post-exploration planning checkpoint, and code checkpoint after exact file/caller/test inspection immediately before the first edit. Before editing, evidence may change either route. Every change must synchronize the plan artifact, repository goal task roadmap through `goal replan`, and native UI plan, including reviews and required evidence. After editing begins, a new Heavy signal promotes Light Path to Heavy Path: stop further edits, mark affected evidence stale, synchronize all three roadmaps, and repeat the code checkpoint.
24
+ - Do not stop before local implementation solely because subagent tools are unavailable; the main agent takes over implementation directly and records that takeover in evidence.
25
+ - Keep work units small. Split large changes into smaller plan tasks.
26
+ - If `apply_patch` is unstable in the environment, use an editing tool or a clear file update path.
27
+ - Do not duplicate the same exploration. Wait for already delegated searches.
28
+ - Do not trust success-looking output alone. Confirm real files, commands, and surface evidence.
29
+ - Do not skip LSP, typecheck, lint, dry-run, or verification because a tool is missing. Try repository-local installation or record the failed install attempt as a blocker.
30
+ - Do not continue an open-ended verification loop. Use at most two verification passes per task unless the plan records a risk-based exception.
31
+ - Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
32
+ - Preserve the stable prompt prefix: keep detailed workflow in phase skills/model guidance, and do not vary a hook capsule with prompt text or turn ID when persisted state is unchanged.
33
+
34
+ ## Path Guidance
35
+
36
+ ### Planning
37
+
38
+ - Use `update_plan` to display the initial triage roadmap before repository exploration, then use `create_goal` when exposed so the Codex UI has an active goal before the turn can be interrupted.
39
+ - Treat the initial plan as decision-complete for its `triage-plan` task, not as authorization to implement. After triage, update the same repository plan and `update_plan` roadmap to the decision-complete implementation revision.
40
+ - On Light Path, write explicit task contracts when a plan artifact exists.
41
+ - Record detected stack, required tools, install commands, and tool blockers.
42
+ - Specify file scope and verification commands so implementation does not need to rediscover them.
43
+ - Specify the dry-run or check command for tasks that can mutate external state, or record why none exists.
44
+ - On failure, prefer sub-task splitting over a repeated loop.
45
+
46
+ ### Implementation
47
+
48
+ - Invest Codex reasoning in executable test design first, then hand the bounded failing contract to implementation and require the minimum passing patch.
49
+ - Run verification through `goal verify -- ...`. Its default timeout is 600,000 ms (10 minutes), capped at 3,600,000 ms (1 hour). On success, retain exact argv, tool exit code, pass count, output digest, and watched-workspace fingerprint; commit evidence only when the starting goal/task identity and pre/post watched fingerprint match. Choose the watch set and command at the semantic boundary that proves the claim. The default Git fingerprint excludes ignored files; explicitly `--watch` every ignored artifact needed by the claim. Expand diagnostics only for the failing test and its related file/symbol scope; reject stale evidence after related changes.
50
+ - If acting as the user-called/main agent, orchestrate the work and delegate actual implementation edits to `worker` whenever subagent tools are available, regardless of Light Path or Heavy Path.
51
+ - If acting as the user-called/main agent, immediately relay received subagent status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion.
52
+ - If acting as the user-called/main agent, close or release completed subagents after capturing their final report and evidence, then review the final report and evidence before marking the work complete.
53
+ - If acting as `worker`, edit only within the file scope listed in the plan.
54
+ - Confirm required tools are available. Install or bootstrap missing required tools before implementation.
55
+ - Run the recorded dry-run or check command before external-state mutation when applicable.
56
+ - After changes, run both module acceptance verification and surface integration verification.
57
+ - Inspect package lifecycle scripts before package verification. Run normal `npm pack --dry-run` by default; content-producing or unknown lifecycle scripts must never use `--ignore-scripts`, while absent or proven content-neutral scripts may use it only when the prior full check remains fresh.
58
+ - If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates. Stop after the second failed pass and record the blocker.
59
+ - Return evidence in a form that can be recorded in `docs/plan/<topic>.md`.
60
+
61
+ ### Delegation
62
+
63
+ - Handle search, file listing, command checks, and QA artifact capture.
64
+ - Use `explorer` for independent read-only discovery or read-only verification when available.
65
+ - When using `worker`, state clear file ownership and tell the worker not to revert others' edits.
66
+ - Tell subagents to report status when the tool provides a progress-reporting channel: starting work, deciding or confirming direction, periodic progress, and finishing.
67
+ - Tell subagents to provide a final report before leaving, then close or release them after evidence is captured. Review the final report and evidence before marking the work complete.
68
+ - If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
@@ -0,0 +1,65 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node \"${PLUGIN_ROOT}/scripts/pota-state.mjs\" session-start",
9
+ "timeout": 10,
10
+ "statusMessage": "Pota: loading read-only repository context"
11
+ }
12
+ ]
13
+ }
14
+ ],
15
+ "UserPromptSubmit": [
16
+ {
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node \"${PLUGIN_ROOT}/scripts/pota-state.mjs\" user-prompt-submit",
21
+ "timeout": 10,
22
+ "statusMessage": "Pota: loading read-only work context"
23
+ }
24
+ ]
25
+ }
26
+ ],
27
+ "PostToolUse": [
28
+ {
29
+ "matcher": "^(apply_patch|write|Write|edit|Edit|multi_edit|multiedit|MultiEdit)$",
30
+ "hooks": [
31
+ {
32
+ "type": "command",
33
+ "command": "node \"${PLUGIN_ROOT}/scripts/pota-state.mjs\" post-tool-use",
34
+ "timeout": 10,
35
+ "statusMessage": "Pota: reminding current goal evidence requirements"
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "Stop": [
41
+ {
42
+ "hooks": [
43
+ {
44
+ "type": "command",
45
+ "command": "node \"${PLUGIN_ROOT}/scripts/pota-state.mjs\" stop",
46
+ "timeout": 10,
47
+ "statusMessage": "Pota: checking the active goal task"
48
+ }
49
+ ]
50
+ }
51
+ ],
52
+ "SubagentStop": [
53
+ {
54
+ "hooks": [
55
+ {
56
+ "type": "command",
57
+ "command": "node \"${PLUGIN_ROOT}/scripts/pota-state.mjs\" subagent-stop",
58
+ "timeout": 10,
59
+ "statusMessage": "Pota: checking this subagent's assigned task"
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ }
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@comento/pota-harness",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "WkNam"
8
+ },
9
+ "homepage": "https://github.com/comento/pota-harness",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/comento/pota-harness.git"
13
+ },
14
+ "keywords": [
15
+ "codex",
16
+ "claude-code",
17
+ "antigravity",
18
+ "agent",
19
+ "harness",
20
+ "plugin",
21
+ "workflow"
22
+ ],
23
+ "bin": {
24
+ "pota": "scripts/pota.mjs"
25
+ },
26
+ "files": [
27
+ ".agents/",
28
+ ".claude/",
29
+ ".codex-plugin/",
30
+ "agents/",
31
+ "commands/",
32
+ "docs/model-guidance/",
33
+ "hooks/",
34
+ "scripts/pota",
35
+ "scripts/*.mjs",
36
+ "skills/",
37
+ "templates/",
38
+ "README.md",
39
+ "README.*.md"
40
+ ],
41
+ "scripts": {
42
+ "check": "node --check scripts/pota.mjs && node --check scripts/pota-paths.mjs && node --check scripts/pota-safe-fs.mjs && node --check scripts/pota-goal.mjs && node --check scripts/pota-state.mjs && node --check scripts/pota-cleanup.mjs && node --check scripts/pota-lifecycle.mjs && node --check scripts/pota-lifecycle-layout.mjs && node --check scripts/pota-lifecycle-hosts.mjs && node --check scripts/pota-update-state.mjs && node --check scripts/pota-auto-upgrade.mjs && node --check scripts/pota-toolcheck.mjs && node -e \"JSON.parse(require('node:fs').readFileSync('package.json','utf8')); JSON.parse(require('node:fs').readFileSync('.codex-plugin/plugin.json','utf8')); JSON.parse(require('node:fs').readFileSync('hooks/hooks.json','utf8'))\" && npm test",
43
+ "test": "node --test",
44
+ "prepack": "npm run check"
45
+ },
46
+ "engines": {
47
+ "node": ">=18"
48
+ }
49
+ }
package/scripts/pota ADDED
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ script_path="$0"
5
+ link_target="$(readlink "$script_path" 2>/dev/null || true)"
6
+ if [ -n "$link_target" ]; then
7
+ case "$link_target" in
8
+ /*) script_path="$link_target" ;;
9
+ *) script_path="$(dirname "$script_path")/$link_target" ;;
10
+ esac
11
+ fi
12
+ script_dir="$(cd "$(dirname "$script_path")" && pwd)"
13
+
14
+ exec node "$script_dir/pota.mjs" "$@"