solmate-skills 2.0.12 → 2.0.13

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 (36) hide show
  1. package/AGENTS.md +9 -0
  2. package/CLAUDE.md +13 -3
  3. package/README.md +91 -5
  4. package/USAGE.md +118 -12
  5. package/bin/cli.js +171 -1
  6. package/bin/harness-artifact.js +621 -0
  7. package/bin/harness-artifact.test.js +520 -0
  8. package/bin/harness-check.js +373 -0
  9. package/bin/harness-check.test.js +159 -0
  10. package/bin/test.js +2 -0
  11. package/docs/01_Concept_Design/01_AGENT_HARNESS_REQUIREMENTS_ANALYSIS.md +162 -0
  12. package/docs/03_Technical_Specs/01_AGENT_HARNESS_ARCHITECTURE.md +376 -0
  13. package/docs/03_Technical_Specs/assets/01_agent_harness_data_flow.svg +94 -0
  14. package/docs/04_Logic_Progress/00_BACKLOG.md +339 -0
  15. package/docs/04_Logic_Progress/01_EXECUTION_PLAN.md +160 -0
  16. package/docs/04_Logic_Progress/03_DECISION_LOG.md +98 -0
  17. package/docs/05_QA_Validation/01_TEST_SCENARIOS.md +313 -0
  18. package/docs/05_QA_Validation/02_AGENT_HARNESS_DESIGN_REVIEW.md +100 -0
  19. package/docs/05_QA_Validation/03_AGENT_HARNESS_CONTRACT_QA.md +96 -0
  20. package/manage-collaboration/SKILL.md +2 -0
  21. package/package.json +6 -4
  22. package/rules-docs/SKILL.md +15 -1
  23. package/rules-product/SKILL.md +30 -6
  24. package/rules-product/agents/openai.yaml +2 -2
  25. package/rules-workflow/SKILL.md +32 -7
  26. package/rules-workflow/adapters/claude/solmate-context-reader.md +17 -0
  27. package/rules-workflow/adapters/claude/solmate-implementer.md +20 -0
  28. package/rules-workflow/adapters/claude/solmate-verifier.md +21 -0
  29. package/rules-workflow/agents/openai.yaml +2 -2
  30. package/rules-workflow/resources/agent-harness-contract.md +187 -0
  31. package/rules-workflow/resources/agent-harness-v1.schema.json +432 -0
  32. package/verify-docs/SKILL.md +33 -6
  33. package/verify-docs/agents/openai.yaml +2 -2
  34. package/verify-implementation/SKILL.md +14 -2
  35. package/verify-implementation/agents/openai.yaml +2 -2
  36. package/verify-skills/SKILL.md +27 -0
@@ -0,0 +1,162 @@
1
+ # Agent Harness Requirements Analysis
2
+ > Created: 2026-07-17 01:04
3
+ > Last Updated: 2026-07-17 01:31
4
+
5
+ ## 1. Purpose
6
+
7
+ This document translates the approved user request into traceable requirements for the next Solmate agent harness iteration. It is the canonical requirements input for architecture, implementation planning, and QA.
8
+
9
+ The requested outcome is not merely a larger agent catalog. The harness must make specialist collaboration reliable across Claude Code and Codex while preserving Solmate's existing document-reference and independent-verification gates.
10
+
11
+ ## 2. User Need
12
+
13
+ The user identified the following needs after reviewing `revfactory/harness` and its generated examples:
14
+
15
+ - establish explicit workflows instead of relying on an agent to improvise the execution order;
16
+ - define operational personas such as Architect, Logic Builder, and QA Inspector;
17
+ - establish an inter-agent communication protocol;
18
+ - handle agent, tool, contract, and verification failures explicitly;
19
+ - create a user-requirements analysis artifact before design and implementation;
20
+ - retain Solmate's stronger machine-enforced document and verification evidence;
21
+ - support both Claude Code and Codex without assuming one runtime's private tool names in the canonical contract.
22
+
23
+ ## 3. Problem Statement
24
+
25
+ The current harness solves two high-risk failures well:
26
+
27
+ 1. implementation can be gated on proof that linked documents were read;
28
+ 2. completion can be gated on independent verification evidence.
29
+
30
+ It does not yet define:
31
+
32
+ - how a request becomes a stable requirements artifact;
33
+ - when an Architect or Logic Builder is necessary;
34
+ - which team topology fits a task;
35
+ - how agents exchange structured status, findings, decisions, and artifact references;
36
+ - how retryable failures differ from contract or approval failures;
37
+ - how intermediate state survives agent or session termination;
38
+ - how role permissions and file ownership prevent conflicting edits;
39
+ - how requirements are traced through design, changes, and QA evidence.
40
+
41
+ ## 4. Target Users And Work Types
42
+
43
+ | User / Work Type | Primary Need | Harness Behavior |
44
+ |---|---|---|
45
+ | Project owner | Retain decision authority | Coordinator routes unresolved scope and risk decisions to the user |
46
+ | New feature work | Convert intent into testable requirements | Requirements Analysis is required before architecture or code |
47
+ | Small code change | Avoid procedural overhead | Use the minimal core path without optional specialists |
48
+ | Complex feature | Separate product, architecture, logic, implementation, and QA concerns | Activate specialists through an Expert Pool decision |
49
+ | Code / deploy work | Prevent unverified completion | Context and Verification Receipts remain mandatory |
50
+ | Docs / prototype work | Keep the process lightweight | Specialist delegation is advisory unless safety or approval is involved |
51
+ | Claude Code | Use native project-agent capabilities | Claude adapter maps the canonical roles to supported project agents |
52
+ | Codex | Use available subagents or tasks | Codex adapter maps the same contract without inventing unsupported files |
53
+
54
+ ## 5. Functional Requirements
55
+
56
+ | ID | Requirement | Priority | Acceptance Summary |
57
+ |---|---|---:|---|
58
+ | FR-001 | Produce a canonical User Requirements Analysis before new-feature design or implementation | P0 | Functional, non-functional, scope, assumptions, questions, and acceptance criteria are present |
59
+ | FR-002 | Maintain a minimal core team and activate optional specialists only when justified | P0 | Small tasks do not automatically spawn Architect, Logic Builder, or Release Guardian |
60
+ | FR-003 | Define every persona with mission, non-goals, inputs, outputs, permissions, escalation, and completion criteria | P0 | Role files can be checked for all mandatory persona fields |
61
+ | FR-004 | Preserve the existing Context Receipt gate and linked-document read proof | P0 | Existing preflight behavior remains compatible |
62
+ | FR-005 | Add architecture and business-logic design gates for tasks whose complexity requires them | P0 | Coordinator records why each optional gate is invoked or skipped |
63
+ | FR-006 | Define a runtime-neutral structured inter-agent message envelope | P0 | Every handoff can identify task, attempt, sender, recipient, status, artifacts, blockers, and next action |
64
+ | FR-007 | Define workflow states and legal transitions, including blocked, rework, degraded, cancelled, and complete | P0 | Illegal completion and bypass transitions are rejected |
65
+ | FR-008 | Keep QA Inspector independent and non-writing | P0 | QA cannot modify implementation files and must return findings through the Coordinator |
66
+ | FR-009 | Distinguish retryable operational errors from context, contract, decision, and verification failures | P0 | Each error class has an explicit retry, escalation, and completion policy |
67
+ | FR-010 | Support Claude Code and Codex through adapters that reference one canonical contract | P0 | Runtime differences do not duplicate the business policy |
68
+ | FR-011 | Preserve intermediate artifacts and attempts for audit and recovery | P1 | Previous attempts are not overwritten; task manifests identify the active attempt |
69
+ | FR-012 | Trace requirements through architecture, logic, implementation, and QA evidence | P0 | Each completed requirement has linked design, change, and verification evidence |
70
+ | FR-013 | Support Pipeline, Fan-out/Fan-in, Expert Pool, Producer-Reviewer, and Supervisor patterns selectively | P1 | Coordinator records the selected topology and reason; hierarchy depth is bounded |
71
+ | FR-014 | Detect role, skill, and contract drift during harness maintenance | P1 | Validation reports missing, duplicate, or stale adapters and role references |
72
+ | FR-015 | Calibrate enforcement through warning tasks before blocking rollout | P0 | Five real tasks record false positives and unresolved gaps before strict mode |
73
+
74
+ ## 6. Non-Functional Requirements
75
+
76
+ | ID | Category | Requirement |
77
+ |---|---|---|
78
+ | NFR-001 | Safety | Authentication, authorization, security, accessibility, data preservation, and verification may not be removed for simplicity |
79
+ | NFR-002 | Auditability | Decisions, handoffs, attempts, failures, and evidence must remain inspectable after the active session ends |
80
+ | NFR-003 | Portability | Canonical contracts may not depend on Claude-only or Codex-only tool names |
81
+ | NFR-004 | Simplicity | The minimal linear workflow is the default; multi-agent topologies require a recorded benefit |
82
+ | NFR-005 | Cost Control | Model choice and agent count are task-sensitive rather than globally fixed to the most expensive option |
83
+ | NFR-006 | Determinism | Machine-checkable fields use versioned structured schemas and explicit state transitions |
84
+ | NFR-007 | Compatibility | Existing backlog receipts and `preflight` / `verify` commands remain valid during migration |
85
+ | NFR-008 | Independence | Verification evidence must come from a role that did not implement the change |
86
+ | NFR-009 | Recoverability | A stopped agent or interrupted session can resume from persisted artifacts without silently restarting the task |
87
+ | NFR-010 | Open Source | Concepts may be inspired by external projects, but Solmate contracts are independently written and attributable where necessary |
88
+
89
+ ## 7. Approved Scope
90
+
91
+ ### Included
92
+
93
+ - requirements-analysis contract and template;
94
+ - core and optional role catalog;
95
+ - persona schema and permission matrix;
96
+ - topology-selection rules;
97
+ - runtime-neutral handoff message schema;
98
+ - task state machine and error classification;
99
+ - artifact ownership and persistence rules;
100
+ - incremental QA and independent final verification;
101
+ - Claude Code and Codex adapter boundaries;
102
+ - validation, pilot, and blocking-rollout plan.
103
+
104
+ ### Excluded From This Design Stage
105
+
106
+ - implementation changes to skills, CLI, or installers;
107
+ - creation of a general-purpose multi-agent runtime service;
108
+ - direct dependency on experimental runtime APIs;
109
+ - automatic model purchasing or account configuration;
110
+ - a visual end-user interface;
111
+ - replacing project-specific domain skills with generic personas.
112
+
113
+ ## 8. Acceptance Criteria
114
+
115
+ - [ ] Every P0 functional requirement maps to an architecture section and QA scenario.
116
+ - [ ] The minimal path remains usable with Coordinator, Context Reader, Implementer, and QA Inspector.
117
+ - [ ] Requirements Analyst, Architect, Logic Builder, and Release Guardian have explicit activation conditions.
118
+ - [ ] Direct peer communication cannot approve scope, decisions, completion, or release.
119
+ - [ ] Code and deploy tasks cannot complete from partial critical artifacts.
120
+ - [ ] QA Inspector cannot edit implementation files or self-resolve its own findings.
121
+ - [ ] Retryable and non-retryable errors have distinct transitions.
122
+ - [ ] Claude Code and Codex use the same role and receipt semantics.
123
+ - [ ] Existing Context, Change, and Verification Receipts remain part of the enhanced workflow.
124
+ - [ ] The design does not require a UI document or HTML Preview because no user-facing screen is introduced.
125
+
126
+ ## 9. Risks And Constraints
127
+
128
+ | Risk | Constraint / Response |
129
+ |---|---|
130
+ | Excessive agents increase cost and coordination latency | Use Expert Pool activation and a four-role minimal path |
131
+ | Free-form messages become untraceable decisions | Require a structured envelope and Coordinator-owned decision recording |
132
+ | Agents write overlapping files | Declare write ownership before implementation and serialize shared-file changes |
133
+ | QA loses independence by fixing findings | Keep QA read-only and route rework to Implementer |
134
+ | Runtime tools evolve | Keep runtime adapters thin and canonical policy tool-neutral |
135
+ | New gates create checklist fatigue | Make architecture and logic gates conditional; retain strict gates only for critical evidence |
136
+ | External source text creates licensing ambiguity | Reimplement concepts in original language and retain source references without copying substantial text |
137
+
138
+ ## 10. Decision Status
139
+
140
+ The user approved the following direction on 2026-07-17:
141
+
142
+ - fixed core team plus optional specialists;
143
+ - canonical project documents plus an execution-only workspace;
144
+ - Coordinator-centered decisions with limited direct peer communication;
145
+ - separate Architect and Logic Builder responsibilities;
146
+ - independent, non-writing QA Inspector;
147
+ - explicit blocked, rework, degraded, and completion states;
148
+ - one canonical contract with Claude Code and Codex adapters.
149
+
150
+ No unresolved product decision blocks the technical design. The user reviewed and approved the design baseline and `TASK-HARNESS-002` implementation on 2026-07-17. Later persona, orchestration, blocking rollout, merge, publish, and deploy phases remain separately gated.
151
+
152
+ ## 11. External References
153
+
154
+ - [revfactory/harness](https://github.com/revfactory/harness) - team topology, persona, file-handoff, and QA ideas used as comparative design input
155
+ - [revfactory/harness-100](https://github.com/revfactory/harness-100) - generated fullstack and product-management examples used to identify useful patterns and unsafe defaults
156
+
157
+ ## 12. Related Documents
158
+
159
+ - **Technical_Specs**: [Agent Harness Architecture](../03_Technical_Specs/01_AGENT_HARNESS_ARCHITECTURE.md) - technical realization of these requirements
160
+ - **Logic_Progress**: [Decision Log](../04_Logic_Progress/03_DECISION_LOG.md) - approved architecture decisions and alternatives
161
+ - **Logic_Progress**: [Execution Plan](../04_Logic_Progress/01_EXECUTION_PLAN.md) - approved design-to-implementation sequence
162
+ - **QA_Validation**: [Agent Harness Test Scenarios](../05_QA_Validation/01_TEST_SCENARIOS.md) - traceable validation criteria
@@ -0,0 +1,376 @@
1
+ # Agent Harness Architecture
2
+ > Created: 2026-07-17 01:04
3
+ > Last Updated: 2026-07-17 01:53
4
+
5
+ ## 1. Architecture Goal
6
+
7
+ The enhanced harness coordinates specialized agents without surrendering user authority, document traceability, implementation scope, or independent verification. It extends the current receipt sequence rather than replacing it.
8
+
9
+ The architecture is deliberately split into two layers:
10
+
11
+ 1. **Canonical policy layer**: runtime-neutral roles, states, messages, artifacts, gates, and failure rules.
12
+ 2. **Runtime adapter layer**: Claude Code and Codex mappings to the capabilities actually available in each runtime.
13
+
14
+ ## 2. Design Principles
15
+
16
+ 1. **User authority is non-delegable**: agents may analyze and recommend; unresolved scope, risk, and release decisions return to the user through the Coordinator.
17
+ 2. **Documents are canonical; messages are transport**: a chat message may announce a result but cannot replace the linked artifact or Receipt.
18
+ 3. **Minimal topology first**: use a linear four-role path unless a specialist or parallel topology provides a specific benefit.
19
+ 4. **Persona does not grant permission**: role identity, tool permission, and file ownership are separately declared.
20
+ 5. **Producer and verifier remain separate**: QA Inspector reports findings and never fixes the implementation it verifies.
21
+ 6. **Failures are states, not prose**: the Coordinator records a typed state and legal next action.
22
+ 7. **No silent degradation**: missing critical context, design, code, or verification cannot be hidden by a partial final report.
23
+ 8. **Adapters are thin**: runtime-specific tool names never become canonical workflow rules.
24
+
25
+ ## 3. System Context And Data Flow
26
+
27
+ ![Agent harness data flow](./assets/01_agent_harness_data_flow.svg)
28
+
29
+ The Coordinator owns the task state. Specialists produce versioned artifacts. The task manifest and event log preserve transport state, while approved project documents remain the source of truth.
30
+
31
+ ## 4. Role Catalog
32
+
33
+ ### 4.1 Core Roles
34
+
35
+ | Role | Activation | Primary Responsibility | Write Authority |
36
+ |---|---|---|---|
37
+ | Coordinator | Always | User communication, topology selection, state transitions, approvals, handoffs, completion decision | Backlog, decision and receipt summaries only |
38
+ | Context Reader | Code and deploy; advisory elsewhere | Read all linked references, detect conflicts, return Context Receipt | None |
39
+ | Implementer | After required design and Context gates pass | Change only approved files and return Change Receipt | Declared implementation ownership |
40
+ | QA Inspector | After a Change Receipt; incrementally for complex work | Independently inspect boundaries, execute checks, return findings and Verification Receipt | None, except a separately approved QA report written by Coordinator |
41
+
42
+ ### 4.2 Optional Specialists
43
+
44
+ | Role | Activation Condition | Required Output | Non-Goal |
45
+ |---|---|---|---|
46
+ | Requirements Analyst | New feature, ambiguous request, multiple stakeholders, or missing acceptance criteria | User Requirements Analysis | Does not choose unresolved product scope |
47
+ | Architect | Cross-module boundary, new API/DB contract, dependency or deployment decision | Architecture Decision Packet | Does not implement the selected design |
48
+ | Logic Builder | Non-trivial business rules, state transitions, retry policy, calculation, or authorization logic | Logic Contract | Does not own UI styling or infrastructure |
49
+ | Frontend Implementer | UI-specific owned files | Frontend Change Receipt contribution | Does not change backend contracts unilaterally |
50
+ | Backend Implementer | API, persistence, authentication, or business-service owned files | Backend Change Receipt contribution | Does not change UI expectations unilaterally |
51
+ | Security Inspector | Authentication, authorization, secrets, uploads, PII, or high-risk boundary | Security findings and evidence | Does not replace QA Inspector |
52
+ | Release Guardian | Publish, deployment, migration, or rollback risk | Release Readiness Receipt | Does not approve its own unresolved risk |
53
+
54
+ ### 4.3 Activation Rules
55
+
56
+ - A small single-module change uses the core path only.
57
+ - Requirements Analyst is mandatory when acceptance criteria cannot be derived from approved documents.
58
+ - Architect is mandatory when a public contract, persistence model, module boundary, dependency, or deployment topology changes.
59
+ - Logic Builder is mandatory when more than one state transition, failure branch, invariant, or domain calculation must be coordinated.
60
+ - Security Inspector is mandatory for authentication, authorization, secret handling, protected uploads, personal data, or external trust boundaries.
61
+ - Release Guardian is mandatory before npm publish, deployment, destructive migration, or rollback-sensitive operations.
62
+ - The Coordinator records `Activated` or `Skipped - reason` for every optional role considered.
63
+
64
+ ## 5. Persona Contract
65
+
66
+ Every runtime agent definition must contain the following fields. Friendly prose may supplement these fields but cannot replace them.
67
+
68
+ | Field | Purpose |
69
+ |---|---|
70
+ | `role_id` | Stable machine identifier |
71
+ | `mission` | One responsibility stated as an outcome |
72
+ | `activation` | Conditions under which the role is invoked |
73
+ | `non_goals` | Explicitly excluded decisions and work |
74
+ | `required_inputs` | Artifact and Receipt prerequisites |
75
+ | `required_outputs` | Schema and canonical destination |
76
+ | `allowed_tools` | Minimum tool capability set |
77
+ | `denied_tools` | Tools prohibited even if the runtime offers them |
78
+ | `write_scope` | Files or directories exclusively owned by the role |
79
+ | `communication` | Allowed message types and recipients |
80
+ | `escalation` | Conditions that return control to Coordinator or user |
81
+ | `completion_criteria` | Evidence required before reporting success |
82
+ | `failure_policy` | Retry and non-retry behavior |
83
+ | `model_policy` | Task-sensitive capability tier, never a globally fixed model |
84
+
85
+ ## 6. Workflow Topology Selection
86
+
87
+ | Pattern | Use When | Solmate Constraint |
88
+ |---|---|---|
89
+ | Linear Pipeline | Default; each output is required by the next stage | Minimal path and default topology |
90
+ | Expert Pool | A specialist is conditionally required | Preferred way to activate Architect, Logic Builder, Security, or Release roles |
91
+ | Fan-out/Fan-in | Independent read-only searches or test groups can run in parallel | Coordinator integrates results; no overlapping writes |
92
+ | Producer-Reviewer | Implementation must be independently assessed | Implementer and QA Inspector remain separate |
93
+ | Supervisor | Work volume requires dynamic allocation | Coordinator remains the only approval and state authority |
94
+ | Hierarchical Delegation | A large task naturally splits into independently owned domains | Maximum depth two; avoid when a flat team is sufficient |
95
+
96
+ The Coordinator records the selected pattern, benefit, agent count, write ownership, and fallback before delegation. Two or more agents alone are not sufficient justification for a team topology.
97
+
98
+ ## 7. Canonical Workflow State Machine
99
+
100
+ ### 7.1 Primary States
101
+
102
+ ```text
103
+ INTAKE
104
+ -> REQUIREMENTS_READY
105
+ -> CONTEXT_LOCKED
106
+ -> DESIGN_READY
107
+ -> IMPLEMENTING
108
+ -> CHANGE_READY
109
+ -> VERIFYING
110
+ -> COMPLETE
111
+ ```
112
+
113
+ `DESIGN_READY` may record Architect and Logic Builder as `Skipped - reason` for a simple task. It does not imply that every task creates extra design documents.
114
+
115
+ ### 7.2 Exception States
116
+
117
+ | State | Meaning | Legal Next State |
118
+ |---|---|---|
119
+ | `BLOCKED_CONTEXT` | Required document missing, unread, stale, or conflicting | `CONTEXT_LOCKED` after correction |
120
+ | `BLOCKED_DECISION` | User-owned scope, risk, or architecture decision unresolved | Previous state after user decision |
121
+ | `BLOCKED_DEPENDENCY` | External service, credential, permission, or environment unavailable | Previous state after dependency recovery |
122
+ | `REWORK` | Implementation or evidence failed an accepted criterion | `IMPLEMENTING` with a new attempt |
123
+ | `DEGRADED` | Required independent runtime capability unavailable | User-approved continuation or `CANCELLED` |
124
+ | `CANCELLED` | User or Coordinator terminates the task | Terminal |
125
+
126
+ ### 7.3 Transition Rules
127
+
128
+ - Only Coordinator changes the canonical task state.
129
+ - Every transition records `from`, `to`, `reason`, `actor`, `timestamp`, and `artifact_refs`.
130
+ - `IMPLEMENTING` requires accepted requirements, passing Context Receipt, and any required design outputs.
131
+ - `VERIFYING` requires a Change Receipt and a frozen diff or commit reference.
132
+ - `COMPLETE` requires a passing Verification Receipt and no unresolved P0/P1 finding.
133
+ - PR, merge, publish, and deploy remain downstream gates and may add Release Guardian requirements.
134
+ - An illegal transition is a contract failure and is never retried automatically.
135
+
136
+ ## 8. Artifact Model
137
+
138
+ ### 8.1 Canonical Project Documents
139
+
140
+ | Artifact | Canonical Location | Owner |
141
+ |---|---|---|
142
+ | User Requirements Analysis | `docs/01_Concept_Design/NN_<FEATURE>_REQUIREMENTS_ANALYSIS.md` | Requirements Analyst, approved by user/Coordinator |
143
+ | UI and flow evidence | `docs/02_UI_Screens/` and `previews/` | UI workflow |
144
+ | Architecture Decision Packet | `docs/03_Technical_Specs/NN_<FEATURE>_ARCHITECTURE.md` | Architect |
145
+ | Logic Contract | `docs/04_Logic_Progress/NN_<FEATURE>_LOGIC.md` | Logic Builder |
146
+ | Backlog and receipt summary | `docs/04_Logic_Progress/00_BACKLOG.md` | Coordinator |
147
+ | QA plan and detailed evidence | `docs/05_QA_Validation/` | QA process, recorded by Coordinator |
148
+
149
+ ### 8.2 Execution Workspace
150
+
151
+ ```text
152
+ _workspace/harness/<task-id>/
153
+ ├── manifest.json
154
+ ├── events.jsonl
155
+ ├── attempt-01/
156
+ │ ├── messages/
157
+ │ ├── artifacts/
158
+ │ └── evidence/
159
+ └── attempt-02/
160
+ └── ...
161
+ ```
162
+
163
+ Rules:
164
+
165
+ - `_workspace/` is execution evidence, not the approved product specification.
166
+ - Attempts are append-only; a retry creates a new attempt directory.
167
+ - `manifest.json` identifies schema version, current state, active attempt, topology, role activation, write ownership, and canonical document links.
168
+ - `events.jsonl` records ordered state-transition events. Structured messages remain under the active attempt's `messages/` directory.
169
+ - Secrets, credentials, raw personal data, and unrestricted production logs are prohibited.
170
+ - The project decides whether `_workspace/` is committed, archived, or ignored; canonical evidence links must remain valid either way.
171
+
172
+ ### 8.3 Version 1 Machine Contract
173
+
174
+ The canonical machine schema is `rules-workflow/resources/agent-harness-v1.schema.json`. It contains the manifest, message, and event JSON Schemas plus the legal transition, critical evidence, core-role, read-only-role, and required Receipt tables used by the validator.
175
+
176
+ The v1 manifest fields are:
177
+
178
+ - `schema_version`, `artifact_type`, `task_id`, `work_type`, `current_state`, and `active_attempt`;
179
+ - `topology` with pattern, reason, active agent count, and fallback;
180
+ - `roles` with `ACTIVE` or `SKIPPED` activation and a required reason;
181
+ - exclusive `write_ownership` scopes;
182
+ - `canonical_documents` and state-relevant `receipts`.
183
+
184
+ The v1 event fields are `schema_version`, `artifact_type`, `event_id`, `task_id`, `attempt`, `sequence`, `timestamp`, `actor`, `from`, `to`, `reason`, `artifact_refs`, `evidence_refs`, and conditional `resume_state`. Message and event validation is paired with the manifest so inactive roles, task/attempt drift, incomplete Receipt evidence, and final-state drift cannot silently pass.
185
+
186
+ The first implementation uses Node standard-library JSON/JSONL parsing and no third-party dependency. Existing backlog Receipt parsing remains unchanged and structured artifacts are opt-in during warning migration.
187
+
188
+ The top-level Draft 2020-12 schema selects exactly one manifest, message, or event with `oneOf`; an `events.jsonl` file validates each non-empty line as an event and then applies ordered-log semantics. Project paths are canonical and relative. Embedded `.` aliases, duplicate separators, parent traversal, URLs, backslashes, and ambiguous wildcards are rejected. Exclusive recursive ownership uses `directory/**` or `**` only.
189
+
190
+ Timestamps use a deterministic Solmate canonical profile over RFC 3339: uppercase `T` and `Z`, years `0001` through `9999`, seconds `00` through `59`, and a required UTC marker or numeric offset. Lowercase variants and leap-second notation are intentionally excluded from generated execution evidence.
191
+
192
+ In the v1 state-event contract, `attempt` increments only on `REWORK -> IMPLEMENTING`. Cancellation and ordinary progress retain the current attempt. `TASK-HARNESS-004` must define the persisted event shape for transient operational retries before that recovery path is enabled.
193
+
194
+ ## 9. Inter-Agent Message Protocol
195
+
196
+ ### 9.1 Message Envelope
197
+
198
+ ```json
199
+ {
200
+ "schema_version": 1,
201
+ "artifact_type": "agent_message",
202
+ "message_id": "msg-01J...",
203
+ "task_id": "TASK-HARNESS-002",
204
+ "attempt": 1,
205
+ "timestamp": "2026-07-17T01:04:00+09:00",
206
+ "from": "architect",
207
+ "to": ["coordinator"],
208
+ "type": "HANDOFF",
209
+ "status": "PASS",
210
+ "summary": "Architecture decision packet is ready.",
211
+ "requirement_refs": ["FR-005", "FR-012"],
212
+ "artifact_refs": ["docs/03_Technical_Specs/01_AGENT_HARNESS_ARCHITECTURE.md"],
213
+ "decision_refs": ["DEC-002"],
214
+ "evidence_refs": [],
215
+ "blockers": [],
216
+ "next_action": "Coordinator may activate Logic Builder.",
217
+ "retry_count": 0
218
+ }
219
+ ```
220
+
221
+ ### 9.2 Message Types
222
+
223
+ | Type | Purpose | Decision Authority |
224
+ |---|---|---|
225
+ | `REQUEST` | Assign approved work | Coordinator |
226
+ | `STATUS` | Report progress without changing scope | Any active role |
227
+ | `QUESTION` | Request clarification | Any active role |
228
+ | `DECISION_REQUIRED` | Escalate an unresolved decision | Coordinator routes to user or decision owner |
229
+ | `HANDOFF` | Transfer a completed artifact | Producing role; Coordinator accepts or rejects |
230
+ | `FINDING` | Report a defect, conflict, or risk | Inspector roles |
231
+ | `REWORK_REQUEST` | Request a new implementation attempt | Coordinator after accepting a finding |
232
+ | `RESULT` | Return final role evidence | Producing role |
233
+
234
+ ### 9.3 Routing Rules
235
+
236
+ - Agents may communicate directly for status, evidence location, or bounded technical clarification.
237
+ - Direct peer `STATUS` and `QUESTION` messages use only `INFO` or `PENDING`; PASS, FAIL, BLOCKED, rework, and completion status route through Coordinator.
238
+ - Scope changes, acceptance changes, architecture decisions, risk acceptance, state transitions, PASS decisions, and releases must route through Coordinator.
239
+ - Direct messages that alter a contract are invalid until recorded as a Coordinator decision and linked artifact update.
240
+ - Large content is never copied into a message; the message contains a summary and artifact reference.
241
+ - Every finding names the violated requirement or contract when one exists.
242
+
243
+ ## 10. Error Handling
244
+
245
+ | Error Class | Examples | Retry | State / Action |
246
+ |---|---|---:|---|
247
+ | Context error | Missing reference, unread document, conflicting specification | 0 | `BLOCKED_CONTEXT`; repair or user decision |
248
+ | Decision error | Unapproved scope, ambiguous product behavior, risk acceptance | 0 | `BLOCKED_DECISION`; ask user |
249
+ | Contract error | Invalid schema, illegal transition, unauthorized write | 0 | Reject message or artifact; return to responsible role |
250
+ | Transient operational error | Temporary network, rate limit, tool process interruption | 1 | Retry same scope in a new recorded attempt |
251
+ | Agent timeout / stop | Agent exits without valid handoff | 1 | Resume or replace role using persisted inputs |
252
+ | Implementation failure | Build, test, or accepted behavior fails | Up to 2 rework loops | `REWORK`; Implementer produces a new Change Receipt |
253
+ | Verification failure | QA finding or required check fails | No QA self-fix | `REWORK`; Coordinator sends finding to Implementer |
254
+ | Critical artifact loss | Requirements, Context, design, code, or verification unavailable | 0 | Block; code/deploy cannot continue with a silent omission |
255
+ | Independent verifier unavailable | Runtime cannot provide independent execution | 0 automatic | `DEGRADED`; explicit user approval required |
256
+ | Conflicting specialist outputs | Two valid but incompatible recommendations | 0 | Preserve both, record trade-off, route decision |
257
+
258
+ Retry rules:
259
+
260
+ - Retrying never broadens scope or changes acceptance criteria.
261
+ - A retry increments the attempt and retains the failed evidence.
262
+ - Repeated transient failure becomes `BLOCKED_DEPENDENCY`.
263
+ - After two rework loops, Coordinator reports the repeated failure pattern and requests a user decision before further changes.
264
+ - Partial output may inform diagnosis but cannot satisfy a missing critical gate.
265
+
266
+ ## 11. Permissions And Ownership
267
+
268
+ | Role | Read | Write | Execute Checks | Approve Scope | Approve Completion |
269
+ |---|:---:|:---:|:---:|:---:|:---:|
270
+ | Coordinator | Yes | Governance docs | Yes | User-confirmed only | Yes, with required evidence |
271
+ | Requirements Analyst | Yes | Requirements draft only | No | No | No |
272
+ | Context Reader | Yes | No | Non-mutating inspection only | No | No |
273
+ | Architect | Yes | Architecture draft only | Non-mutating analysis | No | No |
274
+ | Logic Builder | Yes | Logic draft only | Non-mutating analysis | No | No |
275
+ | Implementer | Yes | Declared implementation scope | Basic checks | No | No |
276
+ | QA Inspector | Yes | No | Verification commands | No | No |
277
+ | Release Guardian | Yes | Release evidence only | Packaging/deploy checks | No | No |
278
+
279
+ Before parallel write work begins, Coordinator records exclusive ownership. Shared files are assigned to one role or updated serially. An agent may not revert or overwrite another role's work to resolve a conflict.
280
+
281
+ ## 12. Receipt Integration
282
+
283
+ The existing Receipts retain their meaning:
284
+
285
+ - **Context Receipt** proves linked references were read and conflicts surfaced.
286
+ - **Change Receipt** states changed files, covered requirements, exclusions, checks, and risks.
287
+ - **Verification Receipt** independently proves accepted criteria and required checks.
288
+
289
+ The enhanced flow adds:
290
+
291
+ - **Requirements Receipt**: approved requirements document, unresolved questions, and scope state;
292
+ - **Design Receipt**: role activation, architecture/logic artifact links, decisions, and skipped-gate reasons;
293
+ - **Error Receipt**: failure class, attempt, evidence, retry decision, and legal next action;
294
+ - **Release Readiness Receipt**: version, package contents, migration, rollback, monitoring, and publish/deploy evidence.
295
+
296
+ Receipt summaries belong in the backlog. Detailed evidence belongs in canonical documents, QA reports, PRs, or the execution workspace according to retention policy.
297
+
298
+ ## 13. Runtime Adapters
299
+
300
+ ### 13.1 Claude Code Adapter
301
+
302
+ - Install namespaced project agents under `.claude/agents/`.
303
+ - Map supported native team or subagent operations to `spawn`, `send`, `wait`, and `close` adapter capabilities.
304
+ - Tool and permission declarations enforce the persona contract where supported.
305
+ - The adapter must not assume experimental team features are available; it reports capability and selects a supported topology.
306
+
307
+ ### 13.2 Codex Adapter
308
+
309
+ - Keep the main task as Coordinator.
310
+ - Use available subagents for bounded Context, specialist, implementation, or QA work.
311
+ - Pass canonical role, artifact, ownership, and message contracts explicitly.
312
+ - Do not invent a `.codex/agents/` project format unless official runtime support exists.
313
+
314
+ ### 13.3 Capability Negotiation
315
+
316
+ At task start, an adapter reports:
317
+
318
+ ```json
319
+ {
320
+ "runtime": "claude-code-or-codex",
321
+ "parallel_agents": true,
322
+ "peer_messages": false,
323
+ "read_only_role_enforcement": true,
324
+ "persistent_agent_resume": false,
325
+ "max_concurrency": 4
326
+ }
327
+ ```
328
+
329
+ Coordinator selects the topology from declared capability. Missing peer messaging does not block the workflow because canonical handoffs are artifact- and Coordinator-based.
330
+
331
+ ## 14. Requirements Traceability
332
+
333
+ Each task maintains a traceability record:
334
+
335
+ | Requirement | Requirements Artifact | Design Artifact | Change Evidence | Verification Evidence | Status |
336
+ |---|---|---|---|---|---|
337
+ | `FR-*` / `NFR-*` | Link | Link or `Skipped - reason` | Change Receipt / diff | QA report / command | Pending / Pass / Fail / Deferred |
338
+
339
+ Rules:
340
+
341
+ - `Deferred` requires a reason and approved future owner; it cannot be used for a P0 requirement in the current scope.
342
+ - A requirement is `Pass` only when independent evidence exists.
343
+ - Requirements added during implementation return the task to `BLOCKED_DECISION` and update the requirements artifact before code resumes.
344
+
345
+ ## 15. Compatibility And Migration
346
+
347
+ - Existing backlog tasks remain valid until they opt into the enhanced fields.
348
+ - Existing `Context Receipt`, `Change Receipt`, `Verification Receipt`, `preflight`, and `verify` behavior remains compatible.
349
+ - New structured manifests begin in warning mode.
350
+ - The first five real code/deploy tasks collect false-positive and missing-capability evidence.
351
+ - Blocking mode activates only after the pilot review and user approval.
352
+ - Structured validation is available through `validate-harness manifest|message|events`; message and event validation requires the matching manifest.
353
+ - Contract failures return exit `1` only in blocking mode, while malformed JSON, missing files, and invalid command input return exit `2` in all modes.
354
+
355
+ ## 16. YAGNI / KISS / DRY Check
356
+
357
+ - One canonical architecture contract is referenced by runtime adapters.
358
+ - Optional agents are activated by need rather than installed as a mandatory full team.
359
+ - No new orchestration server, database, queue, or third-party dependency is required for the first implementation.
360
+ - JSON and JSONL use standard parsers; no custom wire format is introduced.
361
+ - Direct peer communication remains optional because artifact handoffs work in both target runtimes.
362
+ - Safety, evidence, accessibility, security, data preservation, and testability are not simplified away.
363
+
364
+ ## 17. External References
365
+
366
+ - [revfactory/harness](https://github.com/revfactory/harness) - comparative source for team architecture patterns, persona structure, orchestration, and incremental QA
367
+ - [revfactory/harness-100](https://github.com/revfactory/harness-100) - comparative source for fullstack and product-management team examples
368
+ - [Apache License 2.0](https://github.com/revfactory/harness/blob/main/LICENSE) - source material is referenced conceptually; this specification is independently authored rather than copied verbatim
369
+
370
+ ## 18. Related Documents
371
+
372
+ - **Concept_Design**: [Agent Harness Requirements Analysis](../01_Concept_Design/01_AGENT_HARNESS_REQUIREMENTS_ANALYSIS.md) - source requirements and approved scope
373
+ - **Logic_Progress**: [Backlog](../04_Logic_Progress/00_BACKLOG.md) - design and future implementation tasks
374
+ - **Logic_Progress**: [Execution Plan](../04_Logic_Progress/01_EXECUTION_PLAN.md) - staged implementation and rollout
375
+ - **Logic_Progress**: [Decision Log](../04_Logic_Progress/03_DECISION_LOG.md) - approved architecture choices and alternatives
376
+ - **QA_Validation**: [Agent Harness Test Scenarios](../05_QA_Validation/01_TEST_SCENARIOS.md) - requirement and failure-path validation
@@ -0,0 +1,94 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900" role="img" aria-labelledby="title desc">
2
+ <title id="title">Solmate agent harness data flow</title>
3
+ <desc id="desc">User decisions flow through a coordinator to requirements, context, optional design specialists, implementation, independent QA, and release gates. Canonical documents and an execution workspace preserve artifacts and evidence.</desc>
4
+ <defs>
5
+ <marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto" markerUnits="strokeWidth">
6
+ <path d="M0,0 L10,5 L0,10 z" fill="#374151"/>
7
+ </marker>
8
+ <style>
9
+ .title { font: 700 30px system-ui, sans-serif; fill: #111827; }
10
+ .subtitle { font: 400 16px system-ui, sans-serif; fill: #4b5563; }
11
+ .label { font: 700 18px system-ui, sans-serif; fill: #111827; }
12
+ .small { font: 400 14px system-ui, sans-serif; fill: #374151; }
13
+ .box { stroke-width: 2; rx: 6; }
14
+ .line { stroke: #374151; stroke-width: 2.5; fill: none; marker-end: url(#arrow); }
15
+ .dashed { stroke: #6b7280; stroke-width: 2; stroke-dasharray: 8 7; fill: none; marker-end: url(#arrow); }
16
+ </style>
17
+ </defs>
18
+
19
+ <rect width="1600" height="900" fill="#f9fafb"/>
20
+ <text x="80" y="65" class="title">Solmate Agent Harness</text>
21
+ <text x="80" y="94" class="subtitle">Canonical documents carry decisions; structured messages carry status and artifact references.</text>
22
+
23
+ <rect x="70" y="160" width="180" height="96" class="box" fill="#fef3c7" stroke="#b45309"/>
24
+ <text x="160" y="198" text-anchor="middle" class="label">User</text>
25
+ <text x="160" y="224" text-anchor="middle" class="small">scope and risk authority</text>
26
+
27
+ <rect x="315" y="145" width="220" height="126" class="box" fill="#dbeafe" stroke="#1d4ed8"/>
28
+ <text x="425" y="188" text-anchor="middle" class="label">Coordinator</text>
29
+ <text x="425" y="216" text-anchor="middle" class="small">state, topology, approvals</text>
30
+ <text x="425" y="240" text-anchor="middle" class="small">handoff acceptance</text>
31
+
32
+ <rect x="615" y="135" width="240" height="146" class="box" fill="#dcfce7" stroke="#15803d"/>
33
+ <text x="735" y="178" text-anchor="middle" class="label">Requirements Analyst</text>
34
+ <text x="735" y="206" text-anchor="middle" class="small">FR, NFR, AC, scope</text>
35
+ <text x="735" y="230" text-anchor="middle" class="small">questions and assumptions</text>
36
+ <text x="735" y="254" text-anchor="middle" class="small">conditional specialist</text>
37
+
38
+ <rect x="935" y="145" width="220" height="126" class="box" fill="#e0e7ff" stroke="#4338ca"/>
39
+ <text x="1045" y="188" text-anchor="middle" class="label">Context Reader</text>
40
+ <text x="1045" y="216" text-anchor="middle" class="small">linked documents</text>
41
+ <text x="1045" y="240" text-anchor="middle" class="small">Context Receipt</text>
42
+
43
+ <rect x="1240" y="120" width="270" height="176" class="box" fill="#f3e8ff" stroke="#7e22ce"/>
44
+ <text x="1375" y="163" text-anchor="middle" class="label">Expert Pool</text>
45
+ <text x="1375" y="195" text-anchor="middle" class="small">Architect</text>
46
+ <text x="1375" y="220" text-anchor="middle" class="small">Logic Builder</text>
47
+ <text x="1375" y="245" text-anchor="middle" class="small">Security Inspector</text>
48
+ <text x="1375" y="270" text-anchor="middle" class="small">activated only when justified</text>
49
+
50
+ <rect x="760" y="390" width="260" height="145" class="box" fill="#cffafe" stroke="#0e7490"/>
51
+ <text x="890" y="434" text-anchor="middle" class="label">Implementer</text>
52
+ <text x="890" y="462" text-anchor="middle" class="small">exclusive write scope</text>
53
+ <text x="890" y="486" text-anchor="middle" class="small">Change Receipt</text>
54
+ <text x="890" y="510" text-anchor="middle" class="small">new attempt on rework</text>
55
+
56
+ <rect x="1110" y="390" width="260" height="145" class="box" fill="#fee2e2" stroke="#b91c1c"/>
57
+ <text x="1240" y="434" text-anchor="middle" class="label">QA Inspector</text>
58
+ <text x="1240" y="462" text-anchor="middle" class="small">read-only independent checks</text>
59
+ <text x="1240" y="486" text-anchor="middle" class="small">boundary comparison</text>
60
+ <text x="1240" y="510" text-anchor="middle" class="small">Verification Receipt</text>
61
+
62
+ <rect x="470" y="390" width="250" height="145" class="box" fill="#fce7f3" stroke="#be185d"/>
63
+ <text x="595" y="434" text-anchor="middle" class="label">Release Guardian</text>
64
+ <text x="595" y="462" text-anchor="middle" class="small">package and deploy checks</text>
65
+ <text x="595" y="486" text-anchor="middle" class="small">rollback and monitoring</text>
66
+ <text x="595" y="510" text-anchor="middle" class="small">conditional specialist</text>
67
+
68
+ <path d="M250 208 H315" class="line"/>
69
+ <path d="M535 208 H615" class="line"/>
70
+ <path d="M855 208 H935" class="line"/>
71
+ <path d="M1155 208 H1240" class="line"/>
72
+ <path d="M1375 296 V345 H890 V390" class="line"/>
73
+ <path d="M1045 271 V330 H890 V390" class="line"/>
74
+ <path d="M1020 462 H1110" class="line"/>
75
+ <path d="M1110 500 H1045 V570 H890 V535" class="dashed"/>
76
+ <text x="1040" y="592" text-anchor="middle" class="small">FAIL / REWORK through Coordinator</text>
77
+ <path d="M1240 535 V625 H425 V271" class="line"/>
78
+ <path d="M760 500 H720" class="dashed"/>
79
+ <path d="M595 390 V325 H425 V271" class="dashed"/>
80
+
81
+ <rect x="160" y="690" width="560" height="140" class="box" fill="#ffffff" stroke="#374151"/>
82
+ <text x="440" y="732" text-anchor="middle" class="label">Canonical Project Documents</text>
83
+ <text x="440" y="764" text-anchor="middle" class="small">Requirements, Architecture, Logic, Backlog, QA</text>
84
+ <text x="440" y="791" text-anchor="middle" class="small">approved decisions and long-lived evidence</text>
85
+
86
+ <rect x="880" y="690" width="560" height="140" class="box" fill="#ffffff" stroke="#374151"/>
87
+ <text x="1160" y="732" text-anchor="middle" class="label">Execution Workspace</text>
88
+ <text x="1160" y="764" text-anchor="middle" class="small">manifest.json, events.jsonl, attempts, messages</text>
89
+ <text x="1160" y="791" text-anchor="middle" class="small">runtime transport, recovery, and audit trail</text>
90
+
91
+ <path d="M425 271 V655 H440 V690" class="dashed"/>
92
+ <path d="M890 535 V645 H1160 V690" class="dashed"/>
93
+ <path d="M1240 535 V635 H1160 V690" class="dashed"/>
94
+ </svg>