@awak-app/simy-cli 0.7.15 → 0.7.17

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 (121) hide show
  1. package/README.md +225 -98
  2. package/package.json +5 -3
  3. package/src/agent.js +129 -7
  4. package/src/backend-executable.js +7 -6
  5. package/src/bounded-local-task-subtask-pool.js +32 -6
  6. package/src/bounded-local-task-subtasks-contract.js +1 -1
  7. package/src/cli-contract.js +1 -1
  8. package/src/codex-plugins/simy/.codex-plugin/plugin.json +2 -2
  9. package/src/codex-plugins/simy/hooks/README.md +8 -3
  10. package/src/codex-plugins/simy/hooks/delivery-loop.mjs +302 -78
  11. package/src/codex-plugins/simy/hooks/hooks.json +1 -1
  12. package/src/codex-plugins/simy/hooks/loop-kernel/conformance.json +136 -0
  13. package/src/codex-plugins/simy/hooks/loop-kernel/index.mjs +42 -0
  14. package/src/codex-plugins/simy/hooks/loop-kernel/outcome-review.mjs +31 -0
  15. package/src/codex-plugins/simy/hooks/loop-kernel/pin.json +6 -0
  16. package/src/codex-plugins/simy/hooks/loop-kernel/policy.json +141 -0
  17. package/src/codex-plugins/simy/hooks/loop-kernel/task-pool.mjs +34 -0
  18. package/src/codex-plugins/simy/hooks/loop-kernel/work-frontier.mjs +132 -0
  19. package/src/codex-plugins/simy/hooks/loop-kernel.mjs +6 -0
  20. package/src/codex-plugins/simy/hooks/outcome-progress.mjs +16 -5
  21. package/src/codex-plugins/simy/hooks/purpose-completion-contract.mjs +10 -0
  22. package/src/codex-plugins/simy/hooks/purpose-cycle.mjs +12 -11
  23. package/src/codex-plugins/simy/hooks/purpose-evidence.mjs +28 -38
  24. package/src/codex-plugins/simy/hooks/purpose-rule-policy.mjs +1 -2
  25. package/src/codex-plugins/simy/hooks/purpose-rule-review.mjs +5 -63
  26. package/src/codex-plugins/simy/hooks/purpose-search.mjs +21 -4
  27. package/src/codex-plugins/simy/hooks/result-cycle.mjs +166 -0
  28. package/src/codex-plugins/simy/hooks/scene-reasoning.mjs +98 -12
  29. package/src/codex-plugins/simy/hooks/user-experience.mjs +26 -0
  30. package/src/codex-plugins/simy/hooks/work-frontier.mjs +2 -0
  31. package/src/codex-plugins/simy/skills/diagnose/SKILL.md +10 -4
  32. package/src/coding-run-recovery.js +4 -2
  33. package/src/delivery-hooks/claude-workflow.md +10 -7
  34. package/src/delivery-hooks/command.js +76 -10
  35. package/src/delivery-hooks/consistency-monitor.js +20 -4
  36. package/src/delivery-hooks/consult.js +60 -0
  37. package/src/delivery-hooks/diagnosis.js +2 -2
  38. package/src/delivery-hooks/legacy-hook-routing.js +46 -8
  39. package/src/delivery-hooks/local-runtime.js +81 -1
  40. package/src/delivery-hooks/local-supervisor.js +13 -4
  41. package/src/delivery-hooks/repair-continuation.js +80 -0
  42. package/src/delivery-hooks/repair.js +164 -0
  43. package/src/delivery-hooks/supervisor-handover.js +84 -0
  44. package/src/delivery-hooks/supervisor-owner.js +3 -2
  45. package/src/delivery-hooks/supervisor-service.js +38 -6
  46. package/src/delivery-hooks/supervisor-watchdog.js +15 -4
  47. package/src/delivery-hooks/supervisor.js +151 -18
  48. package/src/desktop-access.js +2 -1
  49. package/src/desktop-host.js +35 -2
  50. package/src/durable-local-task-worker.js +372 -58
  51. package/src/execution-capability-contract.js +15 -1
  52. package/src/index.js +3 -3
  53. package/src/local-photos-read.swift +33 -0
  54. package/src/local-photos.js +47 -0
  55. package/src/local-task-attachment-store.js +31 -0
  56. package/src/local-task-destination.js +174 -0
  57. package/src/local-task.js +119 -7
  58. package/src/native-delegation-contract.js +68 -0
  59. package/src/native-provider-identity.js +60 -0
  60. package/src/orchestrator/audit.js +24 -323
  61. package/src/orchestrator/budget.js +22 -11
  62. package/src/orchestrator/charter-validation.js +3 -41
  63. package/src/orchestrator/checklist-continuation.js +2 -14
  64. package/src/orchestrator/completion-contract.js +4 -49
  65. package/src/orchestrator/contract.js +5 -9
  66. package/src/orchestrator/delivery/WORKFLOW.md +30 -710
  67. package/src/orchestrator/delivery/references/acceptance-evidence.md +4 -216
  68. package/src/orchestrator/delivery/references/change-boundary-matrix.md +4 -103
  69. package/src/orchestrator/delivery/references/chrome-user-verification.md +5 -133
  70. package/src/orchestrator/delivery/references/cross-repository-control.md +4 -74
  71. package/src/orchestrator/delivery/references/delivery-levels.md +3 -117
  72. package/src/orchestrator/delivery/references/local-sqm-evidence.md +1 -1
  73. package/src/orchestrator/delivery/references/minimum-completion.md +4 -144
  74. package/src/orchestrator/delivery/references/pr-closure.md +4 -200
  75. package/src/orchestrator/delivery/references/shared-system-specifications.md +4 -161
  76. package/src/orchestrator/delivery/references/state-and-receipts.md +4 -245
  77. package/src/orchestrator/delivery/references/state-model.md +4 -185
  78. package/src/orchestrator/delivery/references/ux-specification.md +4 -95
  79. package/src/orchestrator/delivery-level.js +2 -10
  80. package/src/orchestrator/evidence.js +2 -3
  81. package/src/orchestrator/independent-audit.js +15 -164
  82. package/src/orchestrator/instruction.js +19 -254
  83. package/src/orchestrator/loop.js +35 -95
  84. package/src/orchestrator/outcome-monitor.js +21 -0
  85. package/src/orchestrator/pr-closure.js +2 -16
  86. package/src/orchestrator/recovery.js +32 -2
  87. package/src/orchestrator/ux-specification.js +3 -12
  88. package/src/provider-delegation.js +336 -0
  89. package/src/runner.js +5 -2
  90. package/src/session-supervision/acceptance-reads.js +34 -0
  91. package/src/session-supervision/artifact-observer.js +138 -0
  92. package/src/session-supervision/browser-cdp.js +59 -0
  93. package/src/session-supervision/browser-recovery.js +97 -0
  94. package/src/session-supervision/codex-app-server.js +61 -22
  95. package/src/session-supervision/completion-artifacts.js +44 -0
  96. package/src/session-supervision/consistency-auditor.js +8 -11
  97. package/src/session-supervision/continuation-analysis.js +47 -28
  98. package/src/session-supervision/final-response-recovery.js +5 -0
  99. package/src/session-supervision/index.js +22 -5
  100. package/src/session-supervision/interaction-proxy.js +250 -0
  101. package/src/session-supervision/interaction-task.js +189 -0
  102. package/src/session-supervision/native-interaction.js +102 -0
  103. package/src/session-supervision/provider-failure.js +40 -0
  104. package/src/session-supervision/purpose-instruction.js +14 -14
  105. package/src/session-supervision/purpose-recovery.js +32 -12
  106. package/src/session-supervision/purpose-verification.js +50 -216
  107. package/src/session-supervision/recovery-frontier.js +55 -0
  108. package/src/session-supervision/stop-notifications.js +8 -8
  109. package/src/sqm/agent-skill.js +1 -1
  110. package/src/sqm/checkers.js +12 -6
  111. package/src/sqm/claude-plugin-update.js +22 -8
  112. package/src/sqm/claude-plugin.js +6 -0
  113. package/src/sqm/local-tests.js +2 -1
  114. package/src/sqm/plugin-cache.js +67 -0
  115. package/src/sqm/proof.js +25 -0
  116. package/src/sqm/report.js +1 -0
  117. package/src/sqm/workflow-onboarding.js +3 -39
  118. package/src/sqm/workflow-update.js +17 -6
  119. package/src/startup-preflight.js +2 -20
  120. package/src/team-status-fence-store.js +32 -0
  121. package/src/team-threads.js +457 -0
@@ -1,163 +1,6 @@
1
- # Shared system specifications and delivery review
1
+ # Shared behavior and specifications
2
+ Read existing documentation when it helps understand the change. Keep materially affected descriptions accurate, using the repository's existing structure. Compare related surfaces where the same behavior crosses UI, API, storage or background processing.
2
3
 
3
- Read before planning a Delivery Loop change. The specification belongs to the
4
- system and its team, not to a single run. Use existing team paths and conventions;
5
- if none exist, start `docs/systems/<system-id>/` with an index and the applicable
6
- views below. Repository paths here are a convention, not a demand to move existing
7
- documents or to create a new service. Keep one canonical source for each concept.
4
+ Do not require twelve views, a new specification set, a source ledger, an independent approval or SQM paperwork before implementation. Explain a consequential design choice where it helps maintainers, without duplicating source code or existing documents.
8
5
 
9
- ## Shared baseline and proposed change
10
-
11
- The system index records its owner/maintainers, repository/document links, stable
12
- system ID, As-Is source revision(s) and environment, verified date, and gaps.
13
- Distinguish source-code behavior, locally observed behavior, and deployed behavior.
14
- An old design or green PR is not proof of current production behavior.
15
-
16
- At the start of each run:
17
-
18
- 1. Freeze the experience contract from the original request before proposing a
19
- solution: beneficiary/context, goal, complete usable outcome, observable
20
- moments with what the person sees, understands, and can do next, recovery and
21
- forbidden experiences, and the observation method. Read-only discovery may
22
- inform this record. Give every moment a stable UX/acceptance ID.
23
- 2. Read the existing index and current linked views. Reconcile relevant As-Is with
24
- code and actual behavior; label unknowns, cite evidence, and correct documented
25
- drift without claiming that the drift was part of the requested feature.
26
- 3. Reconcile why the change matters against that contract: current difficulty,
27
- observable success, and non-goals. Preserve the user's original request as an
28
- independent acceptance source; do not replace their outcome with a component
29
- or implementation inventory.
30
- 4. Prepare a proposed To-Be on a branch/change proposal linked from the shared
31
- system index. Record its baseline revision, affected stable IDs, before/after
32
- behavior, dependencies and acceptance oracles. Reuse unchanged views by reference;
33
- do not copy the whole specification into every run or generate empty diagrams.
34
- 5. Link each experience ID to workflow, screen/control, state/sequence, API/event,
35
- data/relationship, permission and runtime boundaries as applicable. Map these
36
- stable system IDs to the run's criterion rows and implementation/evidence locations.
37
- 6. Freeze the delivery-level review plan. At levels that require a separate
38
- design review, obtain it before implementation; at level 3 the independent
39
- final-candidate review may cover design, implementation and evidence together.
40
- Supply the original request, shared baseline, To-Be and affected links. Missing
41
- evidence or contradictory views remains pending/failed, never silently accepted.
42
-
43
- After the exact local candidate is built, update the existing acceptance matrix
44
- and its readable table for those same experience IDs. Compare expected experience,
45
- actual user observation, independent system result, evidence, status, and next
46
- repair across the whole journey. This is a view of the canonical acceptance data,
47
- not another specification. A gap between working parts blocks local user-journey
48
- promotion even if every part passed a narrower test.
49
-
50
- The twelve-view index must account for every category: present (with a canonical
51
- link), unchanged (with a revision), not applicable (with a reason), or unknown
52
- (with an owner/next action). Only create/update a diagram where it describes a
53
- real system concept. For CLI/skill systems, chat/terminal interactions can be the
54
- interface views; do not invent application screens, APIs, tables or infrastructure.
55
-
56
- | View | Primary content | Consistency checks against other views |
57
- | --- | --- | --- |
58
- | art-01-screen-inventory-final | Screens or user interaction surfaces and stable IDs | Every referenced screen/control in workflows, transitions and wireframes exists |
59
- | art-02-screen-transitions | Navigation, entry/exit, failure/recovery | Reachable inventory entries, correct permission guards and state conditions |
60
- | art-03-wireframes | Controls, content, empty/loading/error/success states | Each action has a requirement, transition and downstream sequence; no dead control |
61
- | art-04-functional-requirements | Purpose, beneficiary, outcomes, invariants, acceptance | Every request maps to implementation and evidence through the other affected views |
62
- | art-05-state-machines | Legal states, guards, terminal outcomes, retry/cancel | Sequences/events trigger legal transitions; UI messages match actual final state |
63
- | art-06-permissions | Actor/role, action, resource, authority boundary | UI guards, API checks, ownership and execution roles agree |
64
- | art-07-user-workflows | User goal, steps, completion and recovery experience | Requirements covered end to end through screens, APIs, persistence and runtime |
65
- | art-08-data-dictionary | Fields, meaning, type, requiredness, lifecycle and owner | API/event payloads, ER cardinality and state invariants use the same definitions |
66
- | art-09-sequences | Calls/events through components, errors, asynchronous completion | API names/payloads, states, authorization and deployed component boundaries agree |
67
- | art-10-api-design | Existing APIs, commands or file contracts, errors and compatibility | Sequence inputs/outputs, data meanings and permission checks agree |
68
- | art-11-er-diagram | Entities, relationships, ownership and cardinality | Dictionary and API reads/writes agree; label logical artifact models as non-DB |
69
- | art-12-infrastructure | Repositories, execution environments, services and trust boundaries | Every sequence participant has an actual host/owner; revision/rollout dependencies align |
70
-
71
- ## Review evidence and neutral agents
72
-
73
- Required reviews use independent agents/sessions; an agent must not approve work
74
- it authored. Follow the risk-proportionate plan in `delivery-levels.md` instead of
75
- creating design, cross-view, implementation and PR reviews by default. A reviewer
76
- may cover several review kinds in one receipt when the candidate inputs are the
77
- same, and can re-review fixes it did not implement. Supply raw sources, not desired
78
- answers; require inspected references, discrepancies, uncertainty and a reasoned
79
- verdict. Use the repository-required model (gpt-5.5 / xhigh where mandated and
80
- available). If a required independent review is unavailable, report that gate as
81
- blocked.
82
-
83
- Persist a compact review receipt: reviewer/session identity, review kind, original
84
- request and shared baseline/To-Be references, candidate revisions, inspected views
85
- and evidence, findings, result, and re-review links. An independent reviewer checks:
86
-
87
- - coverage of the original request, user benefit and acceptance oracles;
88
- - consistency for every affected cross-view link, including unchanged neighbors;
89
- - behavior after actual operation, reload/session return and final persistence or
90
- integration outcome where applicable;
91
- - implementation and tests against the proposed To-Be, not just against each other;
92
- - missing/extra functionality, stale evidence and unresolved historical regressions.
93
-
94
- A diagram syntax/link checker helps, but cannot replace semantic cross-view review.
95
- Do not declare neutral review merely by renaming the implementer's role.
96
-
97
- ## SQM before and after PR creation
98
-
99
- Use the installed SQM loop skill. Respect explicit SQM opt-in, existing session and
100
- service authority. Explain unavailable gates; do not install global hooks, weaken
101
- rules, force an upload or switch organizations to obtain a pass.
102
-
103
- For each phase use fresh, separate local paths outside the diff (for example an
104
- ignored `.artifacts/delivery/<run>/sqm/pre-pr/` or `post-pr/` directory):
105
-
106
- ```sh
107
- simy sqm min-check --base <actual-pr-base> --output <phase>/min.json
108
- simy sqm check --base <actual-pr-base> --min-result <phase>/min.json --proof <phase>/proof.json --signed-evidence <phase>/proof.json.signed.json
109
- ```
110
-
111
- Use supported no-upload options when required by the authorized sharing scope.
112
- Read the proof and verify its repository, head, base, working-tree/diff identity,
113
- knowledge bundle version/digest and `outcome.status == passed`; verify the bound
114
- signature using SQM tooling. Exit zero alone is insufficient. Do not edit or commit
115
- between min-check and check. Pin the commit before the pre-PR check; writing proof
116
- into the committed diff would invalidate its identity.
117
-
118
- Before the pre-PR phase, inventory relevant known incidents from the team's shared
119
- incident records, SQM knowledge and repository regression history. Record incident
120
- or source ID, failure boundary, applicable/unaffected/unknown classification,
121
- regression command and result, SQM rule match/coverage, and residual gaps. Link this
122
- ledger from the shared specification so the next task can reuse and improve it.
123
- Separate confirmed incidents from synthetic risk scenarios; never invent history.
124
- Record the proof's outcome reasons and actual `executions`: matched module and
125
- rule counts, scenario evaluation statuses, and blocking versus advisory scope.
126
- Scenario evaluations do not assert that a real browser/provider journey executed.
127
- A zero-match/no-applicable-rules proof does not establish historical coverage.
128
- Use concrete regressions for relevant uncovered incidents and have an independent
129
- reviewer assess coverage; keep missing incident history or untested boundaries
130
- visible. No finite test promises absence of all future bugs.
131
-
132
- Draft creation: after authority and local regressions, publish a Draft so the exact
133
- remote candidate can be inspected. Draft existence is not gate approval.
134
-
135
- Before Ready or merge, pass the frozen review plan. When the explicitly opted-in
136
- plan requires SQM, run it against the final candidate; repair findings within the
137
- bounded loop and rerun affected gates. On an unavailable/failed required proof,
138
- retain Draft/not-ready and report the exact blocker while continuing independent
139
- authorized preparation.
140
-
141
- Post-PR: fetch and verify the actual PR head/base and current CI. Reuse the pre-PR
142
- SQM proof only when repository, head, base, working-tree/diff, specification,
143
- policy, knowledge bundle, evidence and relevant environment identities are exactly
144
- unchanged and the signed proof verifies. Rerun into a new path when any identity
145
- changed or a PR-only scanner/policy becomes applicable. Apply the same rule to
146
- independent review. If a required gate fails, retain the PR as draft/not-ready,
147
- repair and rerun affected gates. Preserve superseded receipts as history.
148
- Promote Ready only with current required gates, including applicable combined-state
149
- verification. Merge and deployment still require their own authority and evidence.
150
-
151
- ## Team maintenance after verification
152
-
153
- Merge reviewed specification changes with the corresponding implementation through
154
- the normal team review process. Record proposed, implemented locally, merged and
155
- verified-in-environment status separately. Advance As-Is only for the revision and
156
- environment actually verified; a merged To-Be is not automatically production As-Is.
157
- Preserve the prior baseline and decisions in version history. If another change
158
- updates a shared view, reconcile its semantics and re-review affected links even
159
- when Git reports no textual conflict. Do not overwrite concurrent edits.
160
-
161
- Each run stores pointers, deltas and evidence in its receipt, not another competing
162
- master specification. Record unresolved drift with an owner, source and next action.
163
- Never lower the intended outcome merely to make an implementation match a diagram.
6
+ Test the combined behavior when multiple repositories contribute to the requested result. Distinguish proposed, locally working, merged and deployed behavior. Avoid overwriting concurrent edits. Use SQM only when explicitly requested; its score or report does not establish a working user journey.
@@ -1,247 +1,6 @@
1
- # State and Receipt Contract
1
+ # State needed to continue safely
2
+ Keep enough existing controller state to resume the same task: its original request and corrections, current result, remaining defects, active operation, target identity, permissions, user stop and budget. Do not require separate delivery receipts, approval forms, matrices or evidence packages.
2
3
 
3
- Read this reference for multi-attempt, resumable, cross-repository, concurrent,
4
- merge, deployment, paid, or externally mutating work.
4
+ Use single-writer updates or compare-and-set for concurrent execution. Preserve operation IDs and provider acknowledgments where they prevent duplicate effects. The same operation ID with different content is a conflict. Reconcile unknown external results before retrying; an absent response is not proof of failure.
5
5
 
6
- ## Delivery snapshot
7
-
8
- Persist one controller-owned snapshot with at least:
9
-
10
- - `run_id`, `state`, monotonic `revision`, and terminal disposition;
11
- - immutable explicit conditions and their stable digest;
12
- - frozen experience-contract identities, their mapping to acceptance rows, and
13
- the current readable local-experience table path and digest;
14
- - acceptance-source identities and digests, architecture boundaries, applicable
15
- rule decisions, human-decision receipt IDs, approved canonical sources and
16
- their precedence and fallback semantics, risk tier, requested/effective
17
- delivery levels, numbering version, safety floor and reason, complete five-level
18
- comparison with per-level hour estimates and assumptions, recommendation and
19
- rationale, and actual user selection receipt only when applicable; preserve legacy numbering and record
20
- verified conversions separately rather than rewriting historical choices;
21
- - repository, base SHA, head SHA, companion SHAs, merge SHA, image digests, and
22
- deployed revision;
23
- - target environments, user journey, user/tenant fixture identities, and
24
- required artifacts;
25
- - applicable gates and their current status;
26
- - frozen acceptance charter digest, current matrix/table paths and digests,
27
- superseded matrix snapshots, and the acceptance validator result for each gate;
28
- - verification-boundary changes, deferred-debt references, and applicable
29
- outcome and guardrail measures, rollout policy, current rollout stage and
30
- latest deterministic release decision;
31
- - attempt number, retry/time/cost budgets, and failure fingerprints;
32
- - append-only receipt IDs, evidence references, timestamps, and cleanup state.
33
-
34
- Use compare-and-set or an equivalent single-writer protocol. Replaying the same
35
- receipt must be a no-op. Reusing an idempotency key with different content is
36
- an integrity failure.
37
-
38
- ## Typed receipts
39
-
40
- Use the smallest applicable receipts rather than free-form completion claims:
41
-
42
- - `CharterReceipt`
43
- - `HumanDecisionReceipt`
44
- - `FailureReproductionReceipt`
45
- - `ImplementationReceipt`
46
- - `LocalVerificationReceipt`
47
- - `AcceptanceEvidenceReceipt` (matrix completeness, not overall completion)
48
- - `IndependentReviewReceipt`
49
- - `PRCIReceipt`
50
- - `IntegrationVerificationReceipt`
51
- - `ContainerEnvironmentReceipt`
52
- - `ChromeUserJourneyReceipt`
53
- - `MergeReceipt`
54
- - `DeploymentIdentityReceipt`
55
- - `RolloutStageReceipt`
56
- - `OutcomeEvaluationReceipt`
57
- - `HealthReceipt`
58
- - `LiveEvidenceReceipt`
59
- - `CleanupReceipt`
60
- - `CompletionReceipt`
61
- - `FailureReceipt`
62
-
63
- Each receipt should contain:
64
-
65
- - schema version, Run ID, module, result ID, input digest, idempotency key, and
66
- production time;
67
- - `success`, `retryable_error`, or `terminal_error`;
68
- - source revisions and environment identity;
69
- - executed action and observed result;
70
- - evidence references such as commands, exit codes, logs, screenshots, video,
71
- network traces, DB rows, artifact hashes, CI/deploy URLs, and timestamps;
72
- - a typed error category and retryability when unsuccessful.
73
-
74
- A `HumanDecisionReceipt` additionally stores or immutably references the exact
75
- decision packet presented to the human. Preserve the question and scope; every
76
- option's user benefit, user and operational risk, compatibility and migration
77
- effects, fallback behavior, reversibility, support and maintenance cost,
78
- security and trust-boundary constraints, validation plan, and material evidence
79
- gaps; any excluded unsafe or non-compliant option and its reason; and any
80
- recommendation separately from the decision. Record the selected option's exact
81
- text and stable ID or digest, conditions attached to the selection, decision
82
- maker, timestamp, and a stable approval reference such as a message or turn ID
83
- or an immutable transcript or artifact digest, with its channel and context when
84
- applicable. The selection may reference a viable presented option or an explicit
85
- user-authored modification or combination. When the user's decision is clear,
86
- executable, and introduces no undisclosed material trade-off, update the packet
87
- and record that same message as approval without requesting confirmation again.
88
- If the decision is ambiguous or introduces a material trade-off not yet explained,
89
- clarify only the unresolved point before proceeding with dependent work. Mandatory
90
- security, privacy, data-integrity, and external-contract constraints still apply.
91
-
92
- For a reversible delegated decision, record an AI decision in the existing
93
- snapshot: source evidence, alternatives, selected option, rationale, assumptions,
94
- rollback and verification. It is not a HumanDecisionReceipt and does not create
95
- new provider authority. Do not emit needs_hil merely because sources conflict,
96
- risk is high or an AI recommendation needs a choice. Apply the 102 perspectives
97
- as critique of the grounded AI judgment.
98
-
99
- A successful `HumanDecisionReceipt` still requires an explicit selection when
100
- irreversible consequences or an explicitly reserved human choice require it.
101
- Only that operation remains needs_hil; independent authorized work proceeds.
102
- Silence is not approval of an irreversible operation. When the matching decision
103
- arrives, continue within the existing task without a second resume request,
104
- unless the user explicitly stopped/paused it.
105
-
106
- ## Monitor verdict and policy action
107
-
108
- The controller persists `thread_state.objective_contract` with the baseline,
109
- current version, digest and explicit human revision lineage. Each attempt stores
110
- `outcome_progress` with its objective digest, independently supported criterion
111
- IDs, unproven IDs and assessment availability. `evaluateOutcomeProgress` separates
112
- current `verified_ids`, `failed_ids`, and `unassessed_ids`; executor test counts,
113
- commits, evidence hashes and reference paths cannot create progress. A new
114
- independently verified criterion resets `no_progress_attempts`. A prior proof
115
- missing from the current review remains unassessed, rather than silently passing.
116
- The historical verified-ID set is used only for comparison, so repeating an old
117
- proof after a regression cannot manufacture new progress.
118
-
119
- Progress continuation uses `{ policy: "progress", maxNoProgressAttempts: 3 }`
120
- with `assessOutcomeProgress`. Three attempts without new verified outcomes,
121
- including attempts that never reach independent review, mark `stalled` with a
122
- specific `stall_reason`. The pure evaluator accepts the same threshold for
123
- Delivery. Legacy runs retain their original stopping policy until the controller
124
- selects progress continuation. Partial independent proof can show progress even
125
- when the overall audit fails; a complete passing audit is still required for
126
- completion. Human and external blockers remain visible alongside machine repairs
127
- in `blockers` and `next_actions`; they do not imply every criterion is blocked.
128
-
129
- Audits bound to a different objective or current candidate evidence identity
130
- cannot supply progress. Revisions reset the comparison baseline and require a
131
- fresh independent review. An old review cannot settle a newer
132
- objective version. Legacy snapshots without an objective contract remain
133
- readable but lose completion status on restore; their original baseline cannot
134
- be reconstructed retrospectively. `USER-GOAL` is tracked separately from
135
- caller-supplied criteria and requires direct independent outcome evidence.
136
-
137
- The executor can propose evidence, and the independent auditor can assess it.
138
- Only the controller computes the progress verdict and state transition. No new
139
- database is required. The CLI writes a redacted private local snapshot before
140
- publishing a state, restores it after restart, and retries Web ledger updates.
141
- The authenticated daemon periodically rechecks PR-ready runs while it is
142
- running. Neither the local record nor the daemon proves that a user outcome
143
- was achieved without independent operation and postcondition evidence.
144
-
145
- The semantic monitor may emit:
146
-
147
- ```text
148
- status:
149
- on_track
150
- insufficient_evidence
151
- goal_drift
152
- retryable_failure
153
- needs_hil
154
- blocked
155
- completed
156
-
157
- recommended_action:
158
- continue
159
- retry_current
160
- propose_replan
161
- request_hil
162
- abort
163
- complete
164
- ```
165
-
166
- The deterministic policy gate checks authorization, applicable state routes,
167
- revision identity, evidence completeness, idempotency, retry budget, repeated
168
- failure fingerprints, and external-effect ambiguity before accepting the
169
- recommendation.
170
-
171
- Do not expose hidden chain-of-thought. Publish only the typed verdict, concise
172
- reason, selected action, and evidence references.
173
-
174
- ## Evidence invalidation
175
-
176
- Evidence is revision-bound:
177
-
178
- | Change | Invalidate |
179
- |---|---|
180
- | Charter or explicit success conditions | All affected downstream gates |
181
- | Human decision, canonical source, precedence, or fallback | All dependent implementation and verification evidence |
182
- | Acceptance source, test oracle, assertion, or CI/security gate changes | The affected gate and all dependent downstream evidence |
183
- | Head SHA or generated source changes | Local, CI, integration, container, and live evidence |
184
- | Base SHA or companion revision changes | Integration and later evidence |
185
- | Container image digest changes | Container user journey and later runtime evidence |
186
- | Merge SHA changes | Deployment identity and live evidence |
187
- | Deployed revision changes | Health and live evidence |
188
- | Browser profile, tenant, or fixture changes | Affected user-journey evidence |
189
- | Outcome/guardrail signal, source, window, threshold, decision, or owner changes | Affected release and outcome evidence |
190
- | Rollout stage, exposure, recovery control, or kill switch changes | Affected rollout and later live evidence |
191
-
192
- Do not discard historical receipts; mark them superseded for the current gate.
193
-
194
- ## Failure handling
195
-
196
- Classify failures before retrying:
197
-
198
- - code defect;
199
- - stale or wrong revision;
200
- - environment/configuration drift;
201
- - weak or contaminated fixture;
202
- - external provider, authorization, rate limit, or timeout;
203
- - contract/schema drift;
204
- - persistence, concurrency, projection, cache, or replica race;
205
- - evidence collection failure.
206
-
207
- Retry only when the classification and policy permit it. Reconcile ambiguous
208
- external effects before retrying. Preserve passing work and repair the smallest
209
- affected surface. Repeated fingerprints require root-cause repair, replan, or
210
- human input rather than identical retries.
211
-
212
- ## Completion predicate
213
-
214
- For the full delivery mode:
215
-
216
- ```text
217
- done =
218
- reproduction_verified
219
- && acceptance_evidence_complete
220
- && minimum_functional_evidence_verified
221
- && locally_verified
222
- && pr_ci_green
223
- && integration_verified
224
- && user_like_local_verified
225
- && merged
226
- && deployed_exact_revision
227
- && health_verified
228
- && live_verified
229
- && production_outcome_evaluated
230
- && cleanup_verified
231
- && completion_receipt_created
232
- ```
233
-
234
- Remove only genuinely non-applicable terms and record why; production outcome
235
- evaluation is non-applicable when no production-impacting release is in scope. If merge or deploy
236
- is outside current authority, stop at the highest proven pre-authority state.
237
-
238
- Acceptance evidence must cover every applicable criterion for the target gate,
239
- with current context and the required user/system layers. After each evaluated
240
- action, refresh the JSON matrix and its readable table; append a receipt for the
241
- update. Keep the frozen charter distinct from mutable results. A charter patch
242
- supersedes the old digest only after the controller verifies its authority.
243
- For `user_like_local_verified`, the current table must cover the frozen experience
244
- contract from real trigger to usable outcome for the exact local candidate. A
245
- collection of narrower passing rows does not waive a missing end-to-end row.
246
-
247
- The CLI records minimum evidence in observed_evidence.minimum_completion, independently of executor status. The independent audit is bound to its matrix digest. Legacy v2 histories remain readable, but missing minimum evidence cannot be reused as passing evidence on resume/recheck. Missing or unsupported charters require a refresh; they do not disable verification.
6
+ Bind a result to the version and environment actually checked. A local result does not establish deployment. Recheck affected behavior after relevant inputs change, without discarding unaffected results. Record actual user authorization in existing state; never invent approval or request it again when it is already clear.
@@ -1,187 +1,6 @@
1
- # Delivery Loop の統合状態モデル
1
+ # Delivery state
2
+ Continue the original request through implementation, direct verification and repair. Finish at the requested endpoint when the behavior works. Explicitly requested independent review is supported; it is not a default stage.
2
3
 
3
- 現行CLIの正本。対象は CLI Agentic Loop (`src/orchestrator/loop.js`) と、
4
- そのexecutorが従うDelivery workflow。ローカルhook型Loopとは区別する。
5
- 図は新しいruntime enumや自動スケジューラを追加しない。
4
+ Wait for actual external dependencies and preserve the resumption condition. Respect user stops and permissions. Reconcile uncertain operations before replaying them. A reference-document update does not invalidate a working result.
6
5
 
7
- ## 1. 利用者が判断する全体図
8
-
9
- 目的は、元の依頼を満たした証拠が揃うまで、安全に実装・検証を続けること。
10
- 「今どこまで証明できたか」「次に何をするか」「今回の終了理由」を分けて保持する。
11
- 以下はexecutor/auditorの行動契約であり、各矢印がCLIに自動実装済みという意味ではない。
12
-
13
- ```mermaid
14
- flowchart TD
15
- Contract[目的・体験・成功条件・権限・終了地点を固定] --> Baseline[現状と再現を確認・リスク相応のレビュー計画]
16
- Baseline --> Work[実装・修正・不足証拠の取得]
17
- Work --> Verify[現在の版で検証・チェックリスト更新]
18
- Verify --> Review[独立レビュー・元の依頼と証拠を照合]
19
- Review --> Decision{未達の原因と次の行動}
20
- Decision -->|安全に修正・再検証できる| Work
21
- Decision -->|CI等が進行中| Wait[上限のある待機・再確認]
22
- Wait --> Verify
23
- Decision -->|本当の権限・入力不足/進捗停止| Hold[未完了を記録・独立して進められる作業は続行]
24
- Hold -->|不足解消・必要な承認・再開| Verify
25
- Decision -->|全行と適用ゲートが合格| Endpoint{固定した終了地点}
26
- Endpoint -->|PRまで| PR[PRの検証結果・残る非対象作業を記録]
27
- Endpoint -->|配備までの権限あり| Release[マージ・exact revision配備・段階的な公開]
28
- Release --> Live[health・実利用経路・成果とguardrailを観測]
29
- Live -->|未達・回帰| Recovery[公開保留/権限内のrollback・修正]
30
- Recovery --> Work
31
- Live -->|合格| Cleanup[cleanupと最終証拠を確認・As-Is更新]
32
- PR --> Final[元の依頼・全行・終了地点を最終照合]
33
- Cleanup --> Final
34
- Final -->|現在の証拠で全条件合格| Complete[依頼範囲の完了を報告]
35
- Final -->|不足・失効| Decision
36
- ```
37
-
38
- - チェックリストの◎相当は現行表記の **✅**。適用する体験・技術の両層に、
39
- 現在の候補と条件に束縛された合格証拠が必要。🟡・❌は完了ではない。
40
- - 目的・体験ID・受入条件は保持する。全行を消さずに修正→検証→更新を繰り返す。
41
- 個別の軽微な指摘の扱いは実際の監査判定に従い、未達の受入条件を軽微扱いして免除しない。
42
- - PRのみの依頼はmerge/deployを許可しない。一方、配備までの依頼をPR作成で終えない。
43
- - 自動待機を装わない。利用できるbounded wait/recheckまたは承認済みmonitorを使い、
44
- 継続不能なら具体的な制約と再開条件を残す。停止指示は尊重する。
45
- - 修正によってhead/base/設定/依存版/環境/成功条件が変われば、影響する証拠を失効させて
46
- 再検証する。過去の合格履歴は消さず、現在も合格とは扱わない。
47
-
48
- ## 2. 証明済みの到達段階と品質ゲート
49
-
50
- 次の13段階は成果のmilestoneであり、下節のcontroller stateとは別。
51
- 順番だけで昇格せず、適用証拠を確認する。非該当は理由を明示する。
52
-
53
- ```mermaid
54
- flowchart LR
55
- chartered --> reproduction_verified --> implemented --> locally_verified
56
- locally_verified --> pr_ci_green --> integration_verified --> user_like_local_verified
57
- user_like_local_verified --> merged --> deployed_exact_revision
58
- deployed_exact_revision --> health_verified --> live_verified --> cleanup_verified --> done
59
- ```
60
-
61
- | 昇格箇所 | 保持すべき品質ゲート |
62
- |---|---|
63
- | chartered / reproduction_verified | 元の依頼・完全な利用体験・As-Is差分・成功契約・権限・レビュー計画 |
64
- | implemented / locally_verified | 修正、体験全体と技術的不変条件、必要な独立レビュー、現行証拠 |
65
- | PR準備と検証 | PR preparationの8行と4条件付きsafeguard、最新remote base/current head、CI・E2E・skip開示・差分・cleanup。明示opt-in時のSQM |
66
- | integration_verified / user_like_local_verified | 統合候補と実利用同等の経路。CI greenだけでは代替しない |
67
- | merged / deployed_exact_revision | 各操作の権限、正確な配備版、rolloutのpromote/hold/rollback条件 |
68
- | health_verified / live_verified | 稼働確認と利用者の成果を区別し、必要な観測windowとguardrailを検証 |
69
- | cleanup_verified / done | 適用する後片付け・最終受入条件・receipt。検証済みAs-Isを更新 |
70
-
71
- この表はworkflow上の要求。各条件の機械検証範囲は既存validatorとcollectorに従い、
72
- 図だけを根拠に検証済みとはしない。詳細は [state and receipts](state-and-receipts.md)、
73
- [minimum completion](minimum-completion.md)、[acceptance evidence](acceptance-evidence.md)。
74
- PR範囲の完了を報告しても、未配備のmilestoneを `done` に進めない。
75
-
76
- ## 3. 現行controllerの実際の制御
77
-
78
- 以下は `loop.js` / `audit.js` と保存済みworker結果の復帰経路。`Gate`、`Receipt`、`RecheckGate`、`Failure` は説明用の判定節点。
79
- 新規runの契約不備は `waiting_human`。resume時も目的・minimum契約を再検査する。
80
-
81
- ```mermaid
82
- flowchart TD
83
- queued --> Gate{目的・minimum契約の検査}
84
- Gate -->|不備| waiting_human
85
- Gate -->|新規| risk_classifying
86
- risk_classifying -->|charter不備| waiting_human
87
- risk_classifying -->|有効| chartering
88
- chartering --> Receipt{保存済みworker結果の検査}
89
- Gate -->|resume・既存attempt・契約有効| Receipt
90
- Receipt -->|保存結果なし| dispatching
91
- Receipt -->|保存結果が不正| waiting_human
92
- Receipt -->|有効な完了結果・同じattemptを復帰| collecting_evidence
93
- dispatching --> coding --> collecting_evidence --> auditing
94
- coding -->|完了結果の保存失敗・復帰対象外で照合待ち| failed
95
- collecting_evidence & auditing & independent_auditing -->|有効な保存結果あり・controller例外| failed
96
- collecting_evidence -->|保存結果あり・収集の再試行も失敗| waiting_human
97
- independent_auditing -->|保存結果あり・証拠再収集の再試行も失敗| waiting_human
98
- auditing -->|合格| independent_auditing
99
- auditing -->|不合格| Failure{失敗原因・進捗・再試行判定}
100
- independent_auditing -->|証拠を再収集し監査・独立レビュー不合格| Failure
101
- independent_auditing -->|両方合格・PR条件未達| pr_ready_for_review
102
- independent_auditing -->|両方合格・PR条件全合格| merge_ready
103
- Failure -->|修正可能| re_instructing
104
- re_instructing --> dispatching
105
- Failure -->|同一失敗/成果の進捗なし| blocked
106
- Failure -->|人の入力が必要/連続して評価不能| waiting_human
107
- pr_ready_for_review -->|callerまたはdaemonのrecheck| RecheckGate{目的契約とレビューの目的digest}
108
- merge_ready -->|callerまたはdaemonのrecheck| RecheckGate
109
- RecheckGate -->|不備| waiting_human
110
- RecheckGate -->|有効| checking_pr
111
- checking_pr -->|現在の証拠・レビュー束縛を含むPR条件未達| pr_ready_for_review
112
- checking_pr -->|現在のPR条件全合格| merge_ready
113
- blocked -->|原因解消・許可されたresume| Gate
114
- waiting_human -->|入力・許可されたresume| Gate
115
- failed -->|復旧対象の完了結果あり・runnerで復元| waiting_human
116
- waiting_human -->|中断復元・有効な完了結果・daemonの認証と作業権限確認| Gate
117
- ```
118
-
119
- - 実行中のstop確認点で `stopped` に戻る。図は割込みを全辺に描いていない。
120
- 停止を自動解除しない。`local_stop_requested` を保持し、手動停止をdaemonの復帰対象にしない。
121
- - `handleFailedAudit` は失敗原因を決定論的に分岐する。修正可能な失敗は
122
- `re_instructing` から次のattemptへ。成果評価不能は成果の停滞と同一視しない。
123
- - `budget.js` は現在 `local_limits_removed: true`。token/回数は観測・通知の値で、
124
- `canStartProvider` は消費量で止めず `codingAttemptCeiling` は無限。
125
- 旧版の「3回/予算切れ→終了」を現行の通常経路として復活させない。
126
- 残っているbudget停止用コードは現行の到達可能な通常経路として描いていない。
127
- 外部providerの制約や停止・承認・進捗保護を無視してよいという意味ではない。
128
- - `runCodingLoop` はPR readinessを返すと終了する。既存attemptがあり、保存済み
129
- `completed_worker_result` がない非resume呼出しは `checking_pr` で再評価し、
130
- 再実装・新しい独立レビューは行わない。修正や新しいレビューが必要なら、
131
- 適切なresumeで新attemptを実行する。保存済み結果がある場合は下記の復帰経路になる。
132
- 既存の認証済みdaemonは稼働中、作業実行が許可され、他のoperation/childがない
133
- PR-ready runを定期recheckする(`agent.js` / `runner.js`)。daemon不在・認証切れでは
134
- この監視を期待できず、recheck自体は修正attemptを開始しない。
135
- この資料は追加のmonitorや自動resumeを起動しない。
136
- - 有効な `completed_worker_result` があれば、同じattemptのworkerを再実行せず
137
- `collecting_evidence` から監査・独立監査をやり直す(`completed_worker_result_recovered`)。
138
- 保存結果は受入証拠ではなく、run・目的digest・attempt等への束縛を再検査する。
139
- 不正な結果は `WORKER_RESULT_UNVERIFIED` で `waiting_human`。
140
- 保存結果がある証拠収集は最大2回再試行し、失敗が続けば結果を保持したまま
141
- `EVIDENCE_COLLECTION_UNAVAILABLE` で `waiting_human`。再開時も同じattemptから再収集する。
142
- 完了結果の永続化失敗は `worker_result_persistence_failed` をrunnerへ伝え、
143
- `failed` と照合待ちを記録する。保存に失敗した結果を安全な復帰用receiptと扱わない。
144
- - 既存daemonは、中断状態(または `controller_result_recovery` 付きの `failed`)を
145
- 復元すると、目的・結果・actor束縛・認証・作業権限を確認し、停止要求や他のoperation/childが
146
- なければ `recoverCompletedLocalCodingRun` で検証を自動復帰する。
147
- すべての `waiting_human` を自動解除する機能ではなく、通常のPR recheckとも別経路。
148
- この既存の復帰制御を説明する資料であり、新しいdaemonやLoopの起動を許可するものではない。
149
- - recheck前の目的契約不正、または評価済み成果の `outcome_progress.objective_digest` 不一致は
150
- `waiting_human`。head/base等に対する `evidence_identity_sha256` の失効・不足は
151
- PR readinessの未達として `pr_ready_for_review` になり、同じ扱いではない。
152
- - `pr_ready_for_review` はpending状態で、名前だけでは実装の合格さえ保証しない。
153
- recheckで古い証拠が失効した場合もこの状態になる。checksとpending reasonsを読む。
154
- - `merge_ready` と `done_gate_passed` は現在のPR readiness判定。
155
- マージ実行、配備、元の依頼全体の完了を証明しない。
156
-
157
- ## 4. 最終報告と証拠の失効
158
-
159
- `verified_complete / best_available / blocked / failed / cancelled` はworkflowの
160
- 終了理由。controller enumと混ぜたり、すべてを `done` に変換したりしない。
161
- `verified_complete` は固定した依頼範囲の全条件が現在の証拠で満たされた場合のみ。
162
-
163
- | 変化・停止 | 必要な行動 |
164
- |---|---|
165
- | head/base/環境/依存版の変化 | 影響する証拠をpendingに戻し、同じ受入IDで再取得・独立照合 |
166
- | 承認された目的変更 | successor契約として履歴保持。旧目的のレビューを再利用しない |
167
- | CIや依存処理の実行中 | bounded wait/recheck。重複jobを起動せず、未変化だけでblockedにしない |
168
- | 人の権限・入力が本当に不足 | affected IDs、根拠、必要入力、owner、再開条件を記録。独立作業は継続 |
169
- | 同じ失敗・成果停滞 | 原因と別の安全な方針を検討し、controllerの保護を迂回せず再開 |
170
- | 中止 | チェックポイントと最高到達段階を保持し、未完了として報告 |
171
-
172
- これは既存制御の説明とexecutor/auditorへの契約であり、追加の遷移強制validatorではない。
173
-
174
- ## 5. 過去版との比較と採用理由
175
-
176
- | 版 | 採用する点 | 単独では足りない点 |
177
- |---|---|---|
178
- | [9月8日 Slack仕様](https://specialist-doctors.slack.com/archives/C04URHQBJV7/p1788832579923809) | 13 milestones、単一controller、証拠・終了理由の分離 | 当時の回数・予算停止を現行に適用できない |
179
- | [9月14日 #79](https://github.com/SpecialistDoctors-Inc/simy-cli/pull/79) | 未達→修正→再検証、確認不能からの復帰、minimumと全体完了の区別 | 体験全体・PR準備・rolloutの詳細が足りない |
180
- | [9月16日 #97](https://github.com/SpecialistDoctors-Inc/simy-cli/pull/97) | 体験・レビュー計画・PR preparation・段階的配備・As-Is更新 | 主経路中心で、待機・修正・再開や実装との対応が読み取りづらい |
181
- | 現行CLI 0.6.11 / 基準commit `3b9b453` | 実際の修正ループ、完了済みworker結果からの検証復帰、証拠再取得、進捗保護、PR recheck | workflowの13 milestonesとcontroller stateを一つの状態として読むと誤解する |
182
- | 本統合版 | 全体判断図+到達段階と品質ゲート+実装制御図を相互参照 | 図や指示による保証範囲を超えた自動制御は追加しない |
183
-
184
- 8月31日・9月2日のSlack ZIP添付は存在と名称のみ確認でき、本文を取得できなかったため、
185
- 内容の優劣を断定していない。上表は読めた一次資料と現行ソースに基づく選定。
186
- 未マージPRの機能は現行として含めない。更新時は `loop.js`、`audit.js`、`budget.js`、
187
- `outcome-monitor.js`、`checklist-continuation.js`、`coding-run-recovery.js`、`runner.js`、`agent.js` と突合し、3層を一緒に見直す。
6
+ Controller states describe execution and actual remaining work. They must not advance merely because paperwork is complete, or remain blocked merely because a form is absent. Local implementation, PR readiness, merge and deployment describe different outcomes.