@manhd_d/ai-harness 0.7.0 → 0.9.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.
- package/CHANGELOG.md +57 -0
- package/CONTRIBUTING.md +4 -0
- package/README.md +19 -57
- package/adapters/java-spring/adapter.yaml +3 -2
- package/adapters/java-spring/checks/verification.yaml +12 -0
- package/adapters/java-spring/evals/cases.json +10 -0
- package/adapters/java-spring/rules/conventions.md +39 -0
- package/adapters/java-spring/rules.md +2 -1
- package/adapters/kubernetes/adapter.yaml +1 -1
- package/adapters/kubernetes/rules.md +3 -0
- package/adapters/react-native/adapter.yaml +6 -3
- package/adapters/react-native/checks/verification.yaml +36 -0
- package/adapters/react-native/evals/cases.json +30 -0
- package/adapters/react-native/rules/conventions.md +34 -0
- package/adapters/react-native/rules.md +5 -1
- package/adapters/react-native/skills/harness-react-native-behavior-testing/SKILL.md +48 -0
- package/adapters/react-native/skills/harness-react-native-screen-delivery/SKILL.md +53 -0
- package/adapters/react-nextjs/adapter.yaml +6 -3
- package/adapters/react-nextjs/checks/verification.yaml +36 -0
- package/adapters/react-nextjs/evals/cases.json +30 -0
- package/adapters/react-nextjs/rules/conventions.md +37 -0
- package/adapters/react-nextjs/rules.md +5 -1
- package/adapters/react-nextjs/skills/harness-react-nextjs-behavior-testing/SKILL.md +48 -0
- package/adapters/react-nextjs/skills/harness-react-nextjs-feature-delivery/SKILL.md +55 -0
- package/capabilities/architecture/README.md +11 -0
- package/capabilities/architecture/agents/architecture-reviewer.md +16 -0
- package/capabilities/architecture/agents/solution-architect.md +16 -0
- package/capabilities/architecture/capability.json +35 -0
- package/capabilities/architecture/checks/verification.json +29 -0
- package/capabilities/architecture/evals/cases.json +35 -0
- package/capabilities/architecture/skills/harness-architecture-change-impact/SKILL.md +43 -0
- package/capabilities/architecture/skills/harness-architecture-decision-records/SKILL.md +43 -0
- package/capabilities/architecture/skills/harness-architecture-project-context/SKILL.md +43 -0
- package/capabilities/architecture/skills/harness-architecture-quality-attributes/SKILL.md +43 -0
- package/capabilities/architecture/skills/harness-architecture-review/SKILL.md +43 -0
- package/capabilities/architecture/skills/harness-architecture-solution-design/SKILL.md +44 -0
- package/capabilities/architecture/templates/adr.md +29 -0
- package/capabilities/architecture/templates/nfr.md +22 -0
- package/capabilities/architecture/templates/overview.md +24 -0
- package/capabilities/architecture/templates/project-map.md +26 -0
- package/capabilities/architecture/templates/review.md +23 -0
- package/capabilities/architecture/templates/solution-design.md +29 -0
- package/capabilities/architecture/workflows/change-review.md +12 -0
- package/capabilities/architecture/workflows/discovery-to-design.md +16 -0
- package/capabilities/delivery/README.md +11 -0
- package/capabilities/delivery/agents/project-manager.md +16 -0
- package/capabilities/delivery/capability.json +29 -0
- package/capabilities/delivery/checks/verification.json +29 -0
- package/capabilities/delivery/evals/cases.json +25 -0
- package/capabilities/delivery/skills/harness-delivery-planning/SKILL.md +43 -0
- package/capabilities/delivery/skills/harness-delivery-risk-management/SKILL.md +42 -0
- package/capabilities/delivery/skills/harness-delivery-scope-change/SKILL.md +43 -0
- package/capabilities/delivery/templates/change-assessment.md +23 -0
- package/capabilities/delivery/templates/delivery-plan.md +25 -0
- package/capabilities/delivery/templates/risk-register.md +19 -0
- package/capabilities/delivery/workflows/execution-change.md +9 -0
- package/capabilities/delivery/workflows/planning.md +12 -0
- package/capabilities/product/README.md +7 -0
- package/capabilities/product/agents/business-analyst.md +3 -0
- package/capabilities/product/agents/product-owner.md +5 -1
- package/capabilities/product/agents/project-manager.md +5 -0
- package/capabilities/product/capability.json +9 -4
- package/capabilities/product/checks/verification.json +12 -0
- package/capabilities/product/evals/cases.json +10 -0
- package/capabilities/product/skills/harness-product-acceptance-criteria/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-backlog-prioritization/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-brd-generation/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-business-analysis/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-document-review/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-idea-discovery/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-knowledge-analysis/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-mvp-definition/SKILL.md +43 -0
- package/capabilities/product/skills/harness-product-prd-generation/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-product-outcomes/SKILL.md +42 -0
- package/capabilities/product/skills/harness-product-product-research/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-srs-generation/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-traceability/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-use-case-generation/SKILL.md +17 -0
- package/capabilities/product/skills/harness-product-user-stories/SKILL.md +17 -0
- package/capabilities/product/templates/mvp.md +25 -0
- package/capabilities/product/templates/outcomes.md +23 -0
- package/capabilities/product/workflows/document-driven.md +4 -0
- package/capabilities/product/workflows/idea-driven.md +4 -0
- package/capabilities/product/workflows/product-to-solution.md +15 -0
- package/cli/agents.js +165 -0
- package/cli/environment.js +14 -1
- package/cli/harness.js +24 -9
- package/cli/main.js +19 -6
- package/config/agents.default.json +80 -0
- package/core/agents/documentation.md +13 -0
- package/core/agents/implementer.md +7 -0
- package/core/agents/orchestrator.md +13 -0
- package/core/agents/planner.md +4 -0
- package/core/agents/reviewer.md +8 -0
- package/core/checks/verification.json +37 -0
- package/core/evals/cases.json +70 -0
- package/core/evals/composition.json +15 -0
- package/core/rules/foundations.md +1 -0
- package/core/rules/project-conventions.md +61 -0
- package/core/workflows/agent-routing.md +28 -0
- package/core/workflows/bugfix.md +2 -0
- package/core/workflows/project-setup.md +9 -1
- package/core/workflows/solution-framing.md +33 -0
- package/core/workflows/spec-to-code.md +11 -3
- package/docs/README.md +39 -0
- package/docs/adapters.md +10 -2
- package/docs/agent-configuration.md +99 -0
- package/docs/agent-handoffs.md +23 -0
- package/docs/architecture.md +22 -1
- package/docs/cli.md +29 -4
- package/docs/documentation-workflows.md +7 -0
- package/docs/end-to-end-workflow.md +14 -1
- package/docs/examples/fullstack-web.md +4 -0
- package/docs/examples/react-native-app.md +4 -0
- package/docs/frontend-mobile.md +76 -0
- package/docs/getting-started.md +46 -78
- package/docs/harness-maintenance.md +80 -0
- package/docs/monetization.md +1 -1
- package/docs/project-configuration.md +4 -0
- package/docs/project-conventions.md +67 -0
- package/docs/research/solution-workflow-sources.md +30 -0
- package/docs/skill-matrix.md +34 -6
- package/docs/solution-workflow.md +67 -0
- package/docs/templates/harness-change-impact.md +30 -0
- package/docs/tool-setup/README.md +70 -0
- package/docs/tool-setup/claude-code.md +57 -0
- package/docs/tool-setup/codex.md +44 -0
- package/docs/tool-setup/copilot.md +42 -0
- package/docs/tool-setup/cursor.md +44 -0
- package/docs/tool-setup/gemini-cli.md +41 -0
- package/docs/versioning.md +38 -0
- package/evals/README.md +13 -0
- package/harness.yaml +4 -2
- package/package.json +2 -1
- package/templates/AGENTS.md +7 -0
- package/templates/openspec/design.md +6 -0
- package/templates/openspec/tasks.md +1 -0
|
@@ -23,3 +23,20 @@ description: Write verifiable acceptance criteria in Given/When/Then for each st
|
|
|
23
23
|
## Constraints
|
|
24
24
|
- Never claim that acceptance tests have run; these are specifications, not execution evidence.
|
|
25
25
|
- Avoid arbitrary time, availability and performance thresholds.
|
|
26
|
+
|
|
27
|
+
## Template
|
|
28
|
+
Read `.harness/capabilities/product/templates/acceptance-criteria.md`; `aih new-doc acceptance-criteria` creates only a missing
|
|
29
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
Synthetic illustration: Given an employee outside the organization, when searching its customer, then access is denied without leaking existence.
|
|
33
|
+
|
|
34
|
+
## Quality checklist
|
|
35
|
+
- Happy, negative and boundary cases are observable.
|
|
36
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
37
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
38
|
+
|
|
39
|
+
## Handoff
|
|
40
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
41
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
42
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -23,3 +23,20 @@ description: Rank proposed requirements transparently using explicit scoring ass
|
|
|
23
23
|
## Constraints
|
|
24
24
|
- AI ranking is advisory; only the authorized PO/PM sets accepted priorities.
|
|
25
25
|
- Do not equate an estimate with a delivery commitment.
|
|
26
|
+
|
|
27
|
+
## Template
|
|
28
|
+
Read `.harness/capabilities/product/templates/backlog.md`; `aih new-doc backlog` creates only a missing
|
|
29
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
Synthetic illustration: Rank secure create/search before optional import using agreed value/dependencies; effort stays unknown without team input.
|
|
33
|
+
|
|
34
|
+
## Quality checklist
|
|
35
|
+
- Priority rationale uses evidence instead of fabricated effort scores.
|
|
36
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
37
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
38
|
+
|
|
39
|
+
## Handoff
|
|
40
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
41
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
42
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -23,3 +23,20 @@ description: Produce a Business Requirements Document with actors, business rule
|
|
|
23
23
|
## Constraints
|
|
24
24
|
- Never self-approve a BRD or invent evidence.
|
|
25
25
|
- Avoid treating template placeholders as finished decisions.
|
|
26
|
+
|
|
27
|
+
## Template
|
|
28
|
+
Read `.harness/capabilities/product/templates/brd.md`; `aih new-doc brd` creates only a missing
|
|
29
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
Synthetic illustration: BRD links the customer-search goal to BR-001; cost/benefit values remain unknown without financial evidence.
|
|
33
|
+
|
|
34
|
+
## Quality checklist
|
|
35
|
+
- Business outcomes and stakeholder decisions are traceable.
|
|
36
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
37
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
38
|
+
|
|
39
|
+
## Handoff
|
|
40
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
41
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
42
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -24,3 +24,20 @@ description: Elicit actors, existing versus future processes, business rules, re
|
|
|
24
24
|
## Constraints
|
|
25
25
|
- No unapproved product scope expansion; no fabricated regulation or SLA.
|
|
26
26
|
- Do not reveal internal source material or imply stakeholder acceptance without a decision record.
|
|
27
|
+
|
|
28
|
+
## Template
|
|
29
|
+
Read `.harness/capabilities/product/templates/business-rules.md`; `aih new-doc business-rules` creates only a missing
|
|
30
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
Synthetic illustration: BR-001 requires organization-scoped search; AS-IS behavior and proposed TO-BE duplicate handling remain distinct.
|
|
34
|
+
|
|
35
|
+
## Quality checklist
|
|
36
|
+
- Business rules and AS-IS/TO-BE preserve source authority.
|
|
37
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
38
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
39
|
+
|
|
40
|
+
## Handoff
|
|
41
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
42
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
43
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -24,3 +24,20 @@ description: Review generated BRD/PRD/stories for traceability, completeness, co
|
|
|
24
24
|
## Constraints
|
|
25
25
|
- Do not invent reviewer signatures, user research, tests or approvals.
|
|
26
26
|
- Do not treat missing information as implicit consent.
|
|
27
|
+
|
|
28
|
+
## Template
|
|
29
|
+
Read `.harness/capabilities/product/templates/review-report.md`; `aih new-doc review-report` creates only a missing
|
|
30
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
Synthetic illustration: Flag conflicting duplicate policies with exact source references; do not turn the reviewed draft into owner approval.
|
|
34
|
+
|
|
35
|
+
## Quality checklist
|
|
36
|
+
- Findings include source, impact and decision owner.
|
|
37
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
38
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
39
|
+
|
|
40
|
+
## Handoff
|
|
41
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
42
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
43
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -25,3 +25,20 @@ description: Collaboratively refine a developer's rough software idea into an ev
|
|
|
25
25
|
- A solo developer may be the approval owner; never invent other stakeholders.
|
|
26
26
|
- No fabricated user interviews, market sizes, competitor prices, dates, sources, or approvals.
|
|
27
27
|
- An idea can remain a draft indefinitely; do not force implementation.
|
|
28
|
+
|
|
29
|
+
## Template
|
|
30
|
+
Read `.harness/capabilities/product/templates/idea.md`; `aih new-doc idea` creates only a missing
|
|
31
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
Synthetic illustration: Original idea is preserved; clarify prototype versus usable MVP and choose the smallest end-to-end journey with the user.
|
|
35
|
+
|
|
36
|
+
## Quality checklist
|
|
37
|
+
- Original words, assumptions, actual answers and non-goals stay visible.
|
|
38
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
39
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
40
|
+
|
|
41
|
+
## Handoff
|
|
42
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
43
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
44
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -26,3 +26,20 @@ description: Catalog product ideas and authorized Confluence, PDF, meeting-note
|
|
|
26
26
|
- Do not pretend to have opened a link if no connected connector or file access exists.
|
|
27
27
|
- Do not store access tokens, private customer records or restricted source contents in a public repository.
|
|
28
28
|
- Record missing or inaccessible sources explicitly; never invent citations.
|
|
29
|
+
|
|
30
|
+
## Template
|
|
31
|
+
Read `.harness/capabilities/product/templates/source-register.md`; `aih new-doc source-register` creates only a missing
|
|
32
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
Synthetic illustration: SRC-001 points to the approved SRS revision; a contradictory unapproved page is recorded as a gap, not merged as fact.
|
|
36
|
+
|
|
37
|
+
## Quality checklist
|
|
38
|
+
- Source authority/version and missing access are explicit.
|
|
39
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
40
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
41
|
+
|
|
42
|
+
## Handoff
|
|
43
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
44
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
45
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: harness-product-mvp-definition
|
|
3
|
+
description: Define a usable MVP with in/out scope, acceptance, minimum safeguards and explicit owner decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# harness-product-mvp-definition
|
|
7
|
+
|
|
8
|
+
## Input
|
|
9
|
+
Original idea or approved requirements, users, constraints, business rules, known alternatives and decision sources.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
1. Identify one target actor, problem and observable user outcome; distinguish prototype, MVP and later release goals.
|
|
13
|
+
2. Map the end-to-end journey, including required authorization, data integrity and recoverable failure behavior.
|
|
14
|
+
3. Compare a few viable scope cuts by value, feasibility, dependency and evidence. Resolve material scope choices with the actual owner; do not accept your own recommendation.
|
|
15
|
+
4. List in/out scope, AC IDs, required NFRs, validation method, success signals and unknown baselines/targets.
|
|
16
|
+
5. Trace each included capability to the journey; defer optional analytics or bulk tools without deferring necessary security.
|
|
17
|
+
6. Check against existing PRD/BA sources, record the agreed version and pass gaps to BA or Architecture.
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
Project-owned docs/product/mvp.md or an MVP section linked from PRD, with scope owner and review status.
|
|
21
|
+
|
|
22
|
+
## Template
|
|
23
|
+
Read `.harness/capabilities/product/templates/mvp.md` from the installed snapshot.
|
|
24
|
+
Use `aih new-doc mvp` only for a missing draft;
|
|
25
|
+
reuse existing authoritative docs or a compact task note when appropriate. Never overwrite approved content.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
Customer-search MVP: an authorized employee creates and finds customers within permitted organization scope. Bulk import is deferred; tenant access checks and duplicate policy are required. Usage target stays unknown until owner confirmation.
|
|
29
|
+
|
|
30
|
+
## Quality checklist
|
|
31
|
+
- A complete user outcome, not an arbitrary count of features
|
|
32
|
+
- Each scope item links AC and minimum quality constraints
|
|
33
|
+
- Explicit exclusions, decision source and unresolved owner questions
|
|
34
|
+
|
|
35
|
+
## Handoff
|
|
36
|
+
State source revisions, requirement/decision IDs, approval status, unresolved questions, output paths,
|
|
37
|
+
actual checks and next role. Use the module workflow; role names are not human authorization.
|
|
38
|
+
|
|
39
|
+
## Constraints
|
|
40
|
+
Follow Core permissions, clarification and project-conventions. Ask only consequential unknowns with
|
|
41
|
+
2–3 distinct options, evidence-based recommendation and free text; reuse established answers.
|
|
42
|
+
No invented source, measured result, target, estimate or approval. No external messaging/publishing,
|
|
43
|
+
paid tool use or production changes beyond the user's explicit authorization.
|
|
@@ -24,3 +24,20 @@ description: Produce a Product Requirements Document with user value, measurable
|
|
|
24
24
|
## Constraints
|
|
25
25
|
- Estimates, success targets and roadmap dates are proposals until stakeholders approve them.
|
|
26
26
|
- Do not silently change BRD scope or promise unverified capabilities.
|
|
27
|
+
|
|
28
|
+
## Template
|
|
29
|
+
Read `.harness/capabilities/product/templates/prd.md`; `aih new-doc prd` creates only a missing
|
|
30
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
Synthetic illustration: PRD includes authorized create/search and defers import; it links MVP/AC and leaves numeric adoption targets pending.
|
|
34
|
+
|
|
35
|
+
## Quality checklist
|
|
36
|
+
- MVP journey, exclusions and minimum quality are explicit.
|
|
37
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
38
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
39
|
+
|
|
40
|
+
## Handoff
|
|
41
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
42
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
43
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: harness-product-product-outcomes
|
|
3
|
+
description: Define product success measures and experiments without inventing baselines or analytics evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# harness-product-product-outcomes
|
|
7
|
+
|
|
8
|
+
## Input
|
|
9
|
+
Reviewed problem/MVP, personas, source evidence, available instrumentation and authorized research.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
1. Identify user value and one primary outcome; keep activity/output measures separate from actual success.
|
|
13
|
+
2. List assumptions, known baselines, evidence strength and measurement access; unknown values stay unknown.
|
|
14
|
+
3. Propose metrics, definitions, event/source, owner and evaluation period; numeric targets need stakeholder evidence or approval.
|
|
15
|
+
4. Choose a bounded experiment or feedback loop; account for privacy, cost and negative outcomes.
|
|
16
|
+
5. Connect results to continue/pivot/stop proposals and backlog updates; only the owner decides scope changes.
|
|
17
|
+
|
|
18
|
+
## Output
|
|
19
|
+
Project-owned docs/product/outcomes.md linked to MVP and PRD.
|
|
20
|
+
|
|
21
|
+
## Template
|
|
22
|
+
Read `.harness/capabilities/product/templates/outcomes.md` from the installed snapshot.
|
|
23
|
+
Use `aih new-doc outcomes` only for a missing draft;
|
|
24
|
+
reuse existing authoritative docs or a compact task note when appropriate. Never overwrite approved content.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
For customer lookup, propose task completion and observed latency as measures. Without real telemetry, label both baseline and target pending instead of claiming a 30% improvement.
|
|
28
|
+
|
|
29
|
+
## Quality checklist
|
|
30
|
+
- Metric has definition/source/owner and review period
|
|
31
|
+
- Hypothesis and actual measurement are distinct
|
|
32
|
+
- Experiment does not silently expand collection or release scope
|
|
33
|
+
|
|
34
|
+
## Handoff
|
|
35
|
+
State source revisions, requirement/decision IDs, approval status, unresolved questions, output paths,
|
|
36
|
+
actual checks and next role. Use the module workflow; role names are not human authorization.
|
|
37
|
+
|
|
38
|
+
## Constraints
|
|
39
|
+
Follow Core permissions, clarification and project-conventions. Ask only consequential unknowns with
|
|
40
|
+
2–3 distinct options, evidence-based recommendation and free text; reuse established answers.
|
|
41
|
+
No invented source, measured result, target, estimate or approval. No external messaging/publishing,
|
|
42
|
+
paid tool use or production changes beyond the user's explicit authorization.
|
|
@@ -25,3 +25,20 @@ description: Research comparable products, user needs and implementation feasibi
|
|
|
25
25
|
- Do not scrape inaccessible services, bypass document permissions or claim browsing occurred when it did not.
|
|
26
26
|
- No fabricated references, metrics, reviews or user interviews.
|
|
27
27
|
- Research is advisory, not an approval or an instruction to change the codebase.
|
|
28
|
+
|
|
29
|
+
## Template
|
|
30
|
+
Read `.harness/capabilities/product/templates/research.md`; `aih new-doc research` creates only a missing
|
|
31
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
Synthetic illustration: With no browsing access, competitor claims are UNKNOWN and research questions are proposed rather than citations invented.
|
|
35
|
+
|
|
36
|
+
## Quality checklist
|
|
37
|
+
- Retrieved facts, inferences and forecasts have provenance.
|
|
38
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
39
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
40
|
+
|
|
41
|
+
## Handoff
|
|
42
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
43
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
44
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -26,3 +26,20 @@ description: Produce a testable Software Requirements Specification linked to ap
|
|
|
26
26
|
- Do not invent protocol guarantees, SLAs, security requirements or existing integrations.
|
|
27
27
|
- Keep product intent separate from chosen technical implementation.
|
|
28
28
|
- Never change code or claim stakeholder approval solely because a document was generated.
|
|
29
|
+
|
|
30
|
+
## Template
|
|
31
|
+
Read `.harness/capabilities/product/templates/srs.md`; `aih new-doc srs` creates only a missing
|
|
32
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
Synthetic illustration: FR-001 defines search behavior; NFR-001 target is pending until agreed and is passed to Architecture for a scenario/test plan.
|
|
36
|
+
|
|
37
|
+
## Quality checklist
|
|
38
|
+
- FR/NFR contracts, exception paths and trace IDs remain consistent.
|
|
39
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
40
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
41
|
+
|
|
42
|
+
## Handoff
|
|
43
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
44
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
45
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -22,3 +22,20 @@ description: Maintain bidirectional links from document sources through BRD/PRD/
|
|
|
22
22
|
## Constraints
|
|
23
23
|
- Links are evidence pointers, not authorization to modify external systems.
|
|
24
24
|
- Never rewrite approved artifacts automatically based on Confluence updates.
|
|
25
|
+
|
|
26
|
+
## Template
|
|
27
|
+
Read `.harness/capabilities/product/templates/traceability.md`; `aih new-doc traceability` creates only a missing
|
|
28
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
Synthetic illustration: SRC-001 → FR-001 → US-001 → AC-US-001-01 → ADR-001/OpenSpec task/test links form a checkable chain.
|
|
32
|
+
|
|
33
|
+
## Quality checklist
|
|
34
|
+
- Stable IDs, source versions and downstream gaps are maintained.
|
|
35
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
36
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
37
|
+
|
|
38
|
+
## Handoff
|
|
39
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
40
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
41
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -24,3 +24,20 @@ description: Translate requirement and story IDs into consistent main, alternati
|
|
|
24
24
|
- Never imply a draft flow is accepted without sign-off.
|
|
25
25
|
- Avoid duplicating product scope in a competing document; reference established IDs.
|
|
26
26
|
- No assumptions about system behavior presented as approved facts.
|
|
27
|
+
|
|
28
|
+
## Template
|
|
29
|
+
Read `.harness/capabilities/product/templates/use-cases.md`; `aih new-doc use-cases` creates only a missing
|
|
30
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
Synthetic illustration: UC-001 contains main lookup, no-result, permission denial and provider timeout paths linked to FR/AC.
|
|
34
|
+
|
|
35
|
+
## Quality checklist
|
|
36
|
+
- Actor, precondition, result and alternate/error flows are explicit.
|
|
37
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
38
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
39
|
+
|
|
40
|
+
## Handoff
|
|
41
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
42
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
43
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -23,3 +23,20 @@ description: Turn approved requirements into atomic epics and user stories with
|
|
|
23
23
|
## Constraints
|
|
24
24
|
- Do not fabricate persona needs or change scope via user-story rewriting.
|
|
25
25
|
- A story marked Ready requires actual acceptance criteria and PO review.
|
|
26
|
+
|
|
27
|
+
## Template
|
|
28
|
+
Read `.harness/capabilities/product/templates/backlog.md`; `aih new-doc backlog` creates only a missing
|
|
29
|
+
draft. Reuse canonical existing documents and source pointers; never regenerate approved content by default.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
Synthetic illustration: US-001: authorized employee finds a customer; links FR-001 and AC-US-001-01, with access-denial criteria.
|
|
33
|
+
|
|
34
|
+
## Quality checklist
|
|
35
|
+
- Story has user value, dependency and observable acceptance.
|
|
36
|
+
- Actual decisions/status and source revisions distinguish approved facts from proposals.
|
|
37
|
+
- Scope, relevant IDs, unresolved questions and verification limits are recorded.
|
|
38
|
+
|
|
39
|
+
## Handoff
|
|
40
|
+
Use `.harness/capabilities/product/workflows/product-to-solution.md`; supply reviewed source/requirement
|
|
41
|
+
IDs, output paths and actual owner decisions to the next BA/PO/SA/PM role as applicable. Return gaps
|
|
42
|
+
to their owner; a single host may perform roles sequentially without claiming independent approval.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# MVP scope
|
|
2
|
+
|
|
3
|
+
Status: draft / pending review
|
|
4
|
+
Owner: TODO
|
|
5
|
+
Sources and revisions: TODO
|
|
6
|
+
Scope / related requirement and decision IDs: TODO
|
|
7
|
+
Last verified against code: TODO (or not applicable with reason)
|
|
8
|
+
|
|
9
|
+
## User and outcome
|
|
10
|
+
Target actor, problem, value-bearing end-to-end journey and validation evidence.
|
|
11
|
+
## Scope cuts
|
|
12
|
+
| Capability | In / out | Value / dependency | Requirement / AC | Decision source |
|
|
13
|
+
| --- | --- | --- | --- | --- |
|
|
14
|
+
| TODO | TODO | TODO | TODO | TODO |
|
|
15
|
+
## Minimum viable quality
|
|
16
|
+
Authorization, data integrity, failure recovery and relevant NFRs that cannot be deferred.
|
|
17
|
+
## Acceptance and learning
|
|
18
|
+
Observable journey completion, success signals, measurement owner, known baseline/target or unknown.
|
|
19
|
+
## Open decisions
|
|
20
|
+
Options/trade-offs, recommended cut with evidence and actual owner answer; unanswered choices remain pending.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Review and handoff
|
|
24
|
+
Record actual owner decisions, unresolved consequential questions, verification performed/skipped,
|
|
25
|
+
next role, source/output paths and affected OpenSpec change. Draft text is not an accepted decision.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Product outcomes
|
|
2
|
+
|
|
3
|
+
Status: draft / pending review
|
|
4
|
+
Owner: TODO
|
|
5
|
+
Sources and revisions: TODO
|
|
6
|
+
Scope / related requirement and decision IDs: TODO
|
|
7
|
+
Last verified against code: TODO (or not applicable with reason)
|
|
8
|
+
|
|
9
|
+
## Value hypothesis
|
|
10
|
+
User problem and expected benefit; link MVP/PRD instead of duplicating scope.
|
|
11
|
+
## Measurement plan
|
|
12
|
+
| Outcome / metric | Definition / source | Baseline | Proposed target / authority | Owner / period |
|
|
13
|
+
| --- | --- | --- | --- | --- |
|
|
14
|
+
| TODO | TODO | unknown | pending | TODO |
|
|
15
|
+
## Experiment and guardrails
|
|
16
|
+
Hypothesis, smallest experiment, cost/privacy limits, negative effects and decision checkpoint.
|
|
17
|
+
## Evidence and next action
|
|
18
|
+
Separate observed results from forecasts; propose continue/pivot/stop without self-approving scope changes.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Review and handoff
|
|
22
|
+
Record actual owner decisions, unresolved consequential questions, verification performed/skipped,
|
|
23
|
+
next role, source/output paths and affected OpenSpec change. Draft text is not an accepted decision.
|
|
@@ -11,3 +11,7 @@ Use when a project already supplies authorized BA/PO materials (Confluence, BRD,
|
|
|
11
11
|
7. **Source changes:** compare actual source revisions and propose a reviewed requirements/code impact diff rather than overwriting user-owned artifacts.
|
|
12
12
|
|
|
13
13
|
Canonical enterprise source stays in the enterprise system; consumer repo stores pointers, versioned derived docs and project-local engineering artifacts. RAG is optional permission-scoped retrieval, not a replacement for a system of record. The `aih` CLI does not ingest data or run agents.
|
|
14
|
+
|
|
15
|
+
For new/material journeys, continue with `product-to-solution.md` after resolving the relevant scope.
|
|
16
|
+
Use reviewed MVP/outcomes and optional Architecture/Delivery to assess solution/dependencies before
|
|
17
|
+
OpenSpec implementation. Existing approved sources remain canonical; small clear changes stay compact.
|
|
@@ -11,3 +11,7 @@ Use this when the developer starts with an idea, including a solo project. Produ
|
|
|
11
11
|
7. **Changes:** when the idea changes, perform impact analysis and propose minimal document diffs; never silently overwrite approved requirements.
|
|
12
12
|
|
|
13
13
|
Deliverables are **consumer-owned** `docs/discovery/`, `docs/product/` and `openspec/` files. For Confluence publishing, preserve URLs/page versions and request explicit write permission; the Harness CLI does not connect or publish to Confluence.
|
|
14
|
+
|
|
15
|
+
For new/material journeys, continue with `product-to-solution.md` after resolving the relevant scope.
|
|
16
|
+
Use reviewed MVP/outcomes and optional Architecture/Delivery to assess solution/dependencies before
|
|
17
|
+
OpenSpec implementation. Existing approved sources remain canonical; small clear changes stay compact.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# BA → PO → Solution → Delivery
|
|
2
|
+
|
|
3
|
+
Use for a new product or material feature. For a small clear fix, use the Core compact path.
|
|
4
|
+
1. BA preserves idea/approved document revisions, identifies users, business rules and contradictions;
|
|
5
|
+
load existing business-analysis/use-case/AC skills. Source/output register is authoritative.
|
|
6
|
+
2. PO uses mvp-definition and product-outcomes to propose a complete journey, in/out scope, minimum
|
|
7
|
+
quality and success evidence. Resolve consequential unknowns with actual owner; no self-approval.
|
|
8
|
+
3. Pass reviewed FR/US/AC/NFR and decision status to installed Architecture discovery-to-design.
|
|
9
|
+
If Architecture is not selected, Core spec uses the same constraints and records relevant choices.
|
|
10
|
+
4. Pass accepted solution boundaries, AC, dependencies and actual estimates to optional Delivery planning;
|
|
11
|
+
absent Delivery, record a proportional task order in the OpenSpec change.
|
|
12
|
+
5. UI/UX can iterate with SA/PO; adapters implement accepted technical decisions. Verify and review
|
|
13
|
+
against requirements/ADRs. Evidence and scope changes loop back to the owning role.
|
|
14
|
+
6. Carry source revisions, IDs, output paths, decisions, unresolved questions, actual checks and next
|
|
15
|
+
owner in every handoff. A role label never creates a worker or approves a stakeholder decision.
|
package/cli/agents.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { safe, stat, readJson, isObject, SLUG, SOURCE, HarnessError } from './files.js';
|
|
4
|
+
|
|
5
|
+
export const AGENT_CONFIG = '.harness/agents.json';
|
|
6
|
+
export const DEFAULT_AGENTS = 'config/agents.default.json';
|
|
7
|
+
export const PRESETS = ['recommended', 'economy', 'custom'];
|
|
8
|
+
export const REASONING = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra'];
|
|
9
|
+
const ROLE = /^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/;
|
|
10
|
+
const text = value => typeof value === 'string' && value.trim() === value && value.length > 0
|
|
11
|
+
&& value.length <= 256 && !/[\x00-\x1f\x7f]/.test(value);
|
|
12
|
+
const requireThat = (condition, label) => { if (!condition) throw new HarnessError('Invalid agent configuration: ' + label); };
|
|
13
|
+
function fields(value, allowed, required, label) {
|
|
14
|
+
requireThat(isObject(value) && Object.keys(value).every(key => allowed.includes(key))
|
|
15
|
+
&& required.every(key => Object.hasOwn(value, key)), label + ' fields');
|
|
16
|
+
}
|
|
17
|
+
function reference(value, label) {
|
|
18
|
+
requireThat(text(value), label + ' must be nonempty single-line text (max 256 characters)');
|
|
19
|
+
if (value.startsWith('@')) requireThat(SLUG.test(value.slice(1)), label + ' alias syntax');
|
|
20
|
+
else requireThat(!/\s/.test(value), label + ' model ID must not contain whitespace');
|
|
21
|
+
}
|
|
22
|
+
function provider(value, label) { requireThat(typeof value === 'string' && SLUG.test(value), label + ' provider ID'); }
|
|
23
|
+
function reasoning(value, label) { requireThat(REASONING.includes(value), label + ' reasoning level'); }
|
|
24
|
+
|
|
25
|
+
export function resolveModel(config, referenceValue, visited = []) {
|
|
26
|
+
if (!referenceValue.startsWith('@')) return { model: referenceValue, provider: config.provider };
|
|
27
|
+
const alias = referenceValue.slice(1);
|
|
28
|
+
requireThat(Object.hasOwn(config.models, alias), 'unknown alias @' + alias);
|
|
29
|
+
requireThat(!visited.includes(alias), 'cyclic alias @' + alias);
|
|
30
|
+
const descriptor = config.models[alias];
|
|
31
|
+
const next = typeof descriptor === 'string' ? descriptor : descriptor.model;
|
|
32
|
+
const resolved = resolveModel(config, next, [...visited, alias]);
|
|
33
|
+
return { ...resolved, provider: typeof descriptor === 'object' ? descriptor.provider ?? resolved.provider : resolved.provider };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function validateAgentConfig(config) {
|
|
37
|
+
fields(config, ['schema_version', 'provider', 'defaultModel', 'defaultReasoning', 'models', 'agents', 'execution', 'hosts'],
|
|
38
|
+
['schema_version', 'provider', 'defaultModel', 'defaultReasoning', 'models', 'agents', 'execution'], 'root');
|
|
39
|
+
requireThat(config.schema_version === 1, 'unsupported schema_version');
|
|
40
|
+
provider(config.provider, 'default'); reference(config.defaultModel, 'defaultModel');
|
|
41
|
+
reasoning(config.defaultReasoning, 'default');
|
|
42
|
+
requireThat(isObject(config.models) && Object.keys(config.models).length <= 64, 'models map (max 64 aliases)');
|
|
43
|
+
for (const [alias, descriptor] of Object.entries(config.models)) {
|
|
44
|
+
requireThat(SLUG.test(alias), 'alias ID');
|
|
45
|
+
if (typeof descriptor === 'string') reference(descriptor, 'models.' + alias);
|
|
46
|
+
else {
|
|
47
|
+
fields(descriptor, ['model', 'provider'], ['model'], 'models.' + alias);
|
|
48
|
+
reference(descriptor.model, 'models.' + alias);
|
|
49
|
+
if (descriptor.provider !== undefined) provider(descriptor.provider, 'models.' + alias);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
resolveModel(config, config.defaultModel);
|
|
53
|
+
for (const alias of Object.keys(config.models)) resolveModel(config, '@' + alias);
|
|
54
|
+
requireThat(isObject(config.agents) && Object.keys(config.agents).length <= 128, 'agents map (max 128 roles)');
|
|
55
|
+
for (const [id, agent] of Object.entries(config.agents)) {
|
|
56
|
+
requireThat(ROLE.test(id), 'role ID must use namespace:role');
|
|
57
|
+
fields(agent, ['model', 'provider', 'reasoning', 'enabled'], [], id);
|
|
58
|
+
if (agent.model !== undefined) { reference(agent.model, id); resolveModel(config, agent.model); }
|
|
59
|
+
if (agent.provider !== undefined) provider(agent.provider, id);
|
|
60
|
+
if (agent.reasoning !== undefined) reasoning(agent.reasoning, id);
|
|
61
|
+
requireThat(agent.enabled === undefined || typeof agent.enabled === 'boolean', id + ' enabled');
|
|
62
|
+
}
|
|
63
|
+
const execution = config.execution;
|
|
64
|
+
fields(execution, ['mode', 'maxConcurrentAgents', 'maxRounds', 'autoEscalateToPremium'],
|
|
65
|
+
['mode', 'maxConcurrentAgents', 'maxRounds', 'autoEscalateToPremium'], 'execution');
|
|
66
|
+
requireThat(['single-agent', 'hybrid', 'multi-agent'].includes(execution.mode), 'execution mode');
|
|
67
|
+
requireThat(Number.isSafeInteger(execution.maxConcurrentAgents) && execution.maxConcurrentAgents >= 1
|
|
68
|
+
&& execution.maxConcurrentAgents <= 32, 'maxConcurrentAgents must be an integer from 1 to 32');
|
|
69
|
+
requireThat(execution.mode !== 'single-agent' || execution.maxConcurrentAgents === 1, 'single-agent requires maxConcurrentAgents=1');
|
|
70
|
+
requireThat(Number.isSafeInteger(execution.maxRounds) && execution.maxRounds >= 1 && execution.maxRounds <= 20,
|
|
71
|
+
'maxRounds must be an integer from 1 to 20');
|
|
72
|
+
requireThat(execution.autoEscalateToPremium === false, 'autoEscalateToPremium must be false; select premium explicitly');
|
|
73
|
+
const hosts = config.hosts ?? {};
|
|
74
|
+
requireThat(isObject(hosts) && Object.keys(hosts).length <= 16, 'hosts map (max 16 profiles)');
|
|
75
|
+
for (const [id, profile] of Object.entries(hosts)) {
|
|
76
|
+
requireThat(SLUG.test(id), 'host ID'); fields(profile, ['models', 'reasoning'], [], 'host ' + id);
|
|
77
|
+
for (const key of ['models', 'reasoning']) {
|
|
78
|
+
const map = profile[key] ?? {};
|
|
79
|
+
requireThat(isObject(map) && Object.keys(map).length <= 128, 'host ' + id + ' ' + key + ' map');
|
|
80
|
+
for (const [from, to] of Object.entries(map)) {
|
|
81
|
+
requireThat(key === 'models' ? text(from) && from.includes('/') : REASONING.includes(from), 'host mapping key');
|
|
82
|
+
requireThat(text(to) && !to.startsWith('@'), 'host mapping target must be explicit native text');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return config;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function readConfiguration(root, relative) {
|
|
90
|
+
const filename = safe(root, relative), info = stat(filename);
|
|
91
|
+
if (!info) return null;
|
|
92
|
+
requireThat(info.isFile() && info.size <= 1024 * 1024, relative + ' must be a file up to 1 MiB');
|
|
93
|
+
let config;
|
|
94
|
+
try { config = JSON.parse(fs.readFileSync(filename, 'utf8')); }
|
|
95
|
+
catch { throw new HarnessError('Invalid JSON in ' + relative); }
|
|
96
|
+
return validateAgentConfig(config);
|
|
97
|
+
}
|
|
98
|
+
export function loadAgentConfig(root) { return readConfiguration(root, AGENT_CONFIG); }
|
|
99
|
+
|
|
100
|
+
export function agentDefaults(source = SOURCE, preset = 'recommended') {
|
|
101
|
+
requireThat(PRESETS.includes(preset), 'unknown preset; use recommended, economy or custom');
|
|
102
|
+
// Older alternate bundles remain usable; the packaged CLI supplies the new canonical seed.
|
|
103
|
+
const config = structuredClone(readConfiguration(source, DEFAULT_AGENTS) ?? readConfiguration(SOURCE, DEFAULT_AGENTS));
|
|
104
|
+
requireThat(config !== null, 'missing canonical default');
|
|
105
|
+
if (preset === 'economy') {
|
|
106
|
+
config.defaultModel = '@economy'; config.defaultReasoning = 'low';
|
|
107
|
+
config.execution.mode = 'single-agent'; config.execution.maxConcurrentAgents = 1;
|
|
108
|
+
for (const agent of Object.values(config.agents)) { agent.model = '@economy'; agent.reasoning = 'low'; }
|
|
109
|
+
}
|
|
110
|
+
return validateAgentConfig(config);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function registeredRoles(source, capabilities = []) {
|
|
114
|
+
const roles = {};
|
|
115
|
+
const folder = path.dirname(safe(source, 'core/agents/.role-index'));
|
|
116
|
+
for (const name of fs.readdirSync(folder).filter(name => name.endsWith('.md')).sort()) {
|
|
117
|
+
roles['core:' + name.slice(0, -3)] = 'core/agents/' + name;
|
|
118
|
+
}
|
|
119
|
+
for (const id of capabilities) {
|
|
120
|
+
const metadata = readJson(safe(source, `capabilities/${id}/capability.json`));
|
|
121
|
+
for (const file of metadata.agents ?? []) {
|
|
122
|
+
const role = id + ':' + path.basename(file, '.md');
|
|
123
|
+
roles[role] = `capabilities/${id}/${file}`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return roles;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function resolveAgent(config, id) {
|
|
130
|
+
const agent = Object.hasOwn(config.agents, id) ? config.agents[id] : {};
|
|
131
|
+
const resolved = resolveModel(config, agent.model ?? config.defaultModel);
|
|
132
|
+
return { id, ...resolved, provider: agent.provider ?? resolved.provider,
|
|
133
|
+
reasoning: agent.reasoning ?? config.defaultReasoning, enabled: agent.enabled !== false,
|
|
134
|
+
source: Object.hasOwn(config.agents, id) ? 'role' : 'project-default' };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function agentPlan(root, host) {
|
|
138
|
+
if (host !== undefined) requireThat(typeof host === 'string' && SLUG.test(host), 'host ID');
|
|
139
|
+
const config = loadAgentConfig(root);
|
|
140
|
+
const presets = [{ label: 'A', value: 'recommended', description: 'Sol, hybrid, at most two concurrent agents when supported.' },
|
|
141
|
+
{ label: 'B', value: 'economy', description: 'Economy model, single-agent roles.' },
|
|
142
|
+
{ label: 'C', value: 'custom', description: 'Edit provider/model/reasoning and role/host mappings explicitly.' }];
|
|
143
|
+
const note = 'Read-only declaration. No provider/model probing, native config writes, agent spawning, concurrency/token enforcement or usage tracking. Verify model access, effort and delegation in the actual host before execution.';
|
|
144
|
+
if (!config) return { status: 'not-configured', configured: false, presets, roles: [], note };
|
|
145
|
+
const lock = readJson(safe(root, '.harness/lock.json'));
|
|
146
|
+
const registry = registeredRoles(path.join(root, '.harness'), lock.capabilities ?? []);
|
|
147
|
+
const ids = [...new Set([...Object.keys(registry), ...Object.keys(config.agents)])].sort();
|
|
148
|
+
const profile = config.hosts?.[host] ?? {};
|
|
149
|
+
const roles = ids.map(id => {
|
|
150
|
+
const requested = resolveAgent(config, id);
|
|
151
|
+
const active = requested.enabled && Object.hasOwn(registry, id);
|
|
152
|
+
const mapping = profile.models?.[requested.provider + '/' + requested.model];
|
|
153
|
+
const incompatible = !mapping && ((host === 'claude-code' &&
|
|
154
|
+
(!['anthropic', 'bedrock', 'vertex'].includes(requested.provider) || requested.model.startsWith('gpt-'))) ||
|
|
155
|
+
(host === 'gemini-cli' && (!['google', 'vertex'].includes(requested.provider) || requested.model.startsWith('gpt-'))));
|
|
156
|
+
return { ...requested, active, contract: registry[id] ? '.harness/' + registry[id] : null,
|
|
157
|
+
host_model: mapping ?? requested.model, host_reasoning: profile.reasoning?.[requested.reasoning] ?? requested.reasoning,
|
|
158
|
+
mapping: mapping ? 'explicit-user-host-mapping' : 'requested',
|
|
159
|
+
availability: active && incompatible ? 'incompatible-provider' : 'unverified',
|
|
160
|
+
runtime_verified: false };
|
|
161
|
+
});
|
|
162
|
+
return { status: roles.some(role => role.active && role.availability === 'incompatible-provider') ? 'host-incompatible' : 'requires-host-verification',
|
|
163
|
+
configured: true, host: host ?? null, presets, execution: config.execution, roles,
|
|
164
|
+
missing_mappings: Object.keys(registry).filter(id => !Object.hasOwn(config.agents, id)), note };
|
|
165
|
+
}
|