@multileaf/ai-workflow 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +19 -1
  3. package/dist/adapter.js +3 -3
  4. package/dist/artifact-paths.d.ts +16 -0
  5. package/dist/artifact-paths.js +51 -0
  6. package/dist/blocking-reasons.d.ts +1 -1
  7. package/dist/blocking-reasons.js +6 -0
  8. package/dist/completion-report.d.ts +17 -0
  9. package/dist/completion-report.js +42 -0
  10. package/dist/dashboard.js +7 -1
  11. package/dist/decision.d.ts +15 -0
  12. package/dist/decision.js +63 -0
  13. package/dist/eval/brief.d.ts +7 -0
  14. package/dist/eval/brief.js +28 -0
  15. package/dist/eval/generated.d.ts +17 -0
  16. package/dist/eval/generated.js +41 -0
  17. package/dist/eval/git.d.ts +13 -0
  18. package/dist/eval/git.js +70 -0
  19. package/dist/eval/monitor.d.ts +32 -0
  20. package/dist/eval/monitor.js +66 -0
  21. package/dist/eval/policy.d.ts +8 -0
  22. package/dist/eval/policy.js +9 -0
  23. package/dist/eval/proposals.d.ts +48 -0
  24. package/dist/eval/proposals.js +202 -0
  25. package/dist/eval/signals.d.ts +21 -0
  26. package/dist/eval/signals.js +155 -0
  27. package/dist/eval/types.d.ts +38 -0
  28. package/dist/eval/types.js +1 -0
  29. package/dist/eval/validate.d.ts +28 -0
  30. package/dist/eval/validate.js +66 -0
  31. package/dist/generator.d.ts +8 -1
  32. package/dist/generator.js +24 -1
  33. package/dist/recommendations.js +11 -0
  34. package/dist/risk-assess.d.ts +1 -1
  35. package/dist/risk-assess.js +26 -2
  36. package/dist/semantic.d.ts +19 -0
  37. package/dist/semantic.js +57 -0
  38. package/dist/services.d.ts +3 -0
  39. package/dist/telemetry.d.ts +6 -0
  40. package/dist/telemetry.js +14 -7
  41. package/dist/update.d.ts +42 -0
  42. package/dist/update.js +89 -0
  43. package/dist/workflow.js +583 -71
  44. package/docs/backlog.md +20 -2
  45. package/docs/continuation-inventory.md +24 -23
  46. package/docs/decision-model-evaluation.md +7 -2
  47. package/docs/opportunities/OPP-007-decision-findings-triage-scope-watch.md +1 -1
  48. package/docs/opportunities/OPP-008-embedding-covering-tests-judge-context.md +1 -1
  49. package/docs/semantic-mapping.md +9 -0
  50. package/package.json +1 -1
  51. package/resources/evals/scenarios/evaluator-draft-contract.yml +65 -0
  52. package/resources/package.yaml +2 -0
  53. package/resources/skills/research.md +64 -0
  54. package/resources/skills/resource-evaluator.md +24 -0
  55. package/resources/skills/review-judge-a.md +4 -0
  56. package/resources/skills/review-judge-b.md +4 -0
  57. package/resources/skills/review-refuter.md +4 -0
  58. package/resources/skills/ticket.md +1 -1
package/docs/backlog.md CHANGED
@@ -119,8 +119,8 @@ Derived from the Gentle-AI ODD/RDD analysis; scope and rejected alternatives rec
119
119
  - [x] **OPP-004** Emit typed reason codes and exact continuation commands on every blocking exit. _Acceptance:_ see [OPP-004](../opportunities/OPP-004-exact-continuation-commands.md); every block carries a reason code and either a tested runnable `next_command` or an explicit terminal statement; continuation inventory stays complete in CI.
120
120
  - [x] **OPP-005** Add a friction benchmark classifying blocks as in-band / out-of-band / dead-end over packaged-CLI journeys. _Acceptance:_ see [OPP-005](../opportunities/OPP-005-friction-benchmark.md); deterministic classification, continuations actually executed, CI fails on any dead end.
121
121
  - [x] **OPP-006** Adopt the emission ≠ usability test policy: messages naming a command must have a test executing it. _Acceptance:_ see [OPP-006](../opportunities/OPP-006-emission-usability-test-policy.md); extraction helper covers emitted and generated command mentions; generated `ai-init` skills' commands are executed in e2e tests.
122
- - [ ] **OPP-007** Decision model — findings-evidence triage and lane scope-watch (advisory-only). _Acceptance:_ see [OPP-007](../opportunities/OPP-007-decision-findings-triage-scope-watch.md); unconfigured = byte-identical offline behavior; advisory flags never block, never lower tiers, never choose lanes.
123
- - [ ] **OPP-008** Embedding retrieval — covering-test detection and judge context scoping. _Acceptance:_ see [OPP-008](../opportunities/OPP-008-embedding-covering-tests-judge-context.md); retrieval only prevents false `untested` flags (absence fails safe toward high); scoped judge prompts labeled as context aids within token ceilings.
122
+ - [x] **OPP-007** Decision model — findings-evidence triage and lane scope-watch (advisory-only). _Acceptance:_ see [OPP-007](../opportunities/OPP-007-decision-findings-triage-scope-watch.md); unconfigured = byte-identical offline behavior; advisory flags never block, never lower tiers, never choose lanes.
123
+ - [x] **OPP-008** Embedding retrieval — covering-test detection and judge context scoping. _Acceptance:_ see [OPP-008](../opportunities/OPP-008-embedding-covering-tests-judge-context.md); retrieval only prevents false `untested` flags (absence fails safe toward high); scoped judge prompts labeled as context aids within token ceilings.
124
124
  - [x] **OPP-009** Processes as entry points — bug-fixing and idea-assessment process registries alongside the feature SDD lane. _Acceptance:_ see [OPP-009](../opportunities/OPP-009-process-entry-points.md); per-process stage lists, diagnosis/assessment artifacts with gates, default feature process byte-identical, archived ledgers backward compatible.
125
125
  - [x] **OPP-010** Worktree isolation for orchestrated execution (`orchestrate --isolate`). _Acceptance:_ see [OPP-010](../opportunities/OPP-010-orchestration-worktree-isolation.md); per-task worktrees, evidence-bound checkpoints, capability-declared adapter refusal, cleanup guarded by doctor; no flag = unchanged behavior.
126
126
  - [x] **OPP-011** Evals + red-team layer for generated artifacts. _Acceptance:_ see [OPP-011](../opportunities/OPP-011-evals-redteam-generated-artifacts.md); per-adapter contract invariants in CI, deterministic injection fixtures, offline local run, ratchet for skill/template changes.
@@ -132,6 +132,24 @@ Derived from the Gentle-AI ODD/RDD analysis; scope and rejected alternatives rec
132
132
  - [x] **OPP-017** Orchestration depth — integration forecast, doctor leak reporting, diff-stat evidence, per-harness honor matrix. _Acceptance:_ see [OPP-017](../opportunities/OPP-017-orchestration-depth.md); wave-ordered merge forecast with merge-tree dry run, typed cleanup continuation from doctor, no auto-merge.
133
133
  - [x] **OPP-018** Supported migration path for legacy (pre-ownership) installations. _Acceptance:_ see [OPP-018](../opportunities/OPP-018-legacy-migration.md); dry-run lists archived/rebuilt/preserved/manual, transactional apply with rollback, fail-closed on ambiguity, doctor/install point at `aiw migrate`.
134
134
 
135
+ ## Workflow friction review — P1/P2
136
+
137
+ Findings from using AIW on this repository (post-0.15 dogfooding review).
138
+
139
+ - [x] **FRIC-001** Generate a semantic-retrieval-first rule when semantic mapping is enabled. _Acceptance:_ when `.aiw/semantic.yml` is enabled and an index exists, the generator emits a rule instructing agents to prefer `aiw semantic query` over raw grep/rg for context retrieval, with grep still recommended for exact-string matches; regenerating without semantic mapping omits the rule; generated skills pass eval contracts.
140
+ - [x] **FRIC-002** Make the ticket requirement optional or self-served in `task start`. _Acceptance:_ `aiw task start --ticket=TEAM-123` is unchanged; `--no-ticket` (or interactive prompt when no ticket is given) creates a local ticket identifier (e.g., `LOCAL-001`) recorded in the session; validation of explicit ticket formats is unchanged; all stages, gates, and traceability that read `session.ticket` work with local tickets.
141
+ - [x] **FRIC-003** Emit a usage/cost report when a workflow completes. _Acceptance:_ `aiw workflow complete` and light-lane completion print a summary of recorded token usage, sidecar cost attribution, and stage timeline from existing `usage-sidecar`/`cost-attribution` data; when no usage was recorded the summary states so and suggests `aiw usage-sidecar record`; report is also written as an artifact under `.aiw/generated/reports/`.
142
+ - [x] **FRIC-004** Offer telemetry opt-in during install/doctor instead of silent default-off. _Acceptance:_ interactive install and `aiw doctor` prompt once to enable telemetry with the privacy summary when it is unset; non-interactive installs and `--yes` flows never prompt and default remains disabled; repeated runs do not re-prompt once a choice is recorded.
143
+ - [x] **FRIC-005** Namespace per-workflow generated artifacts to prevent overwrite and context contamination. _Acceptance:_ stage artifacts are written under a per-workflow path (e.g., `generated/specs/<workflowId>/brainstorm.md`) instead of fixed shared paths like `generated/specs/brainstorm.md`; `approvalArtifactPath`, quality gates, the approval ledger's artifact fingerprints, traceability, and context retrieval resolve paths through the active workflow id; starting a new workflow never overwrites or reads a previous workflow's artifacts; existing installations migrate or read legacy fixed paths with an advisory; completed workflows' artifacts are archived alongside the session.
144
+
145
+ ## Research — P1
146
+
147
+ - [x] **RES-001** Ship the bounded `research` skill. _Acceptance:_ see `.aiw/generated/specs/f83c066d-0084-42fb-b501-02c78949f5bd/specification.md` (REQ-001…005): scope gate with human confirmation, step/turn budget with stop conditions and escalation, evidence-first citations (fact/hypothesis/unverified; uncited → open question), secret redaction and provenance for host-side external research, durable workflow-scoped `research.md` artifact with light-lane evidence recording, packaged and recommended advisory-only with eval contracts.
148
+
149
+ ## Resource update — P1
150
+
151
+ - [x] **UPD-001** Bundled-resource update command. _Acceptance:_ see `.aiw/generated/specs/4962f74d-8508-41de-a0e6-4b54b190eb92/specification.md` (REQ-001…004): catalog-vs-installed diff (updated/new/unchanged), drift-safe replacement via the ownership-checksum oracle with typed `update_conflict` blocks, additive `--add=type/id` installation, dry-run, non-interactive and idempotent.
152
+
135
153
  ## Backlog rules
136
154
 
137
155
  - [x] **FND-009** Add self-validation workflow. _Acceptance:_ changes affecting AIW behavior execute against this repository and record generated-output evidence.
@@ -6,26 +6,27 @@ Every blocking `aiw` exit carries a stable reason code plus either an exact runn
6
6
  - With `--json`, blocking exits return `{ "reason_code": ..., "next_command" | "next_action" | "terminal": ... }`.
7
7
  - The table below is generated from the registry; a test in `src/blocking-reasons.test.ts` fails CI when this page drifts from the code.
8
8
 
9
- | Reason code | Description | Continuation |
10
- | ------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------- |
11
- | `gate_evidence_missing` | The quality gate is blocked because the required evidence artifact is missing. | explicit action |
12
- | `gate_incomplete` | The quality gate found completeness issues in the stage artifact. | explicit action |
13
- | `stage_prerequisite_pending` | A previous stage is awaiting human approval before this stage can start. | runnable command |
14
- | `stage_prerequisite_unresolved` | Previous stages need human approval or an accepted optional skip before this stage can start. | runnable command |
15
- | `stage_awaiting_approval` | This stage is awaiting human approval; approve or reject it before continuing. | runnable command |
16
- | `stage_already_approved` | This stage is already approved; changed evidence requires rerunning its quality gate. | runnable command |
17
- | `approval_evidence_missing` | Approval cannot be recorded because the stage evidence artifact is missing. | explicit action |
18
- | `approval_stale` | The artifact changed after review; its approval is stale and the gate must run again. | runnable command |
19
- | `approval_gate_missing` | No passing quality gate is recorded for this stage; gate it before approving. | runnable command |
20
- | `lane_escalation_required` | Light-lane workflows do not author stage artifacts; escalate to the full lane to continue. | explicit action |
21
- | `light_evidence_missing` | A light-lane workflow cannot complete without at least one recorded validation entry. | explicit action |
22
- | `workflow_still_active` | A workflow is already active; finish or archive it before starting another. | explicit action |
23
- | `workflow_not_active` | No SDD workflow is active for this command to operate on. | runnable command |
24
- | `workflow_complete` | This workflow is already complete; start a new workflow to continue working. | runnable command |
25
- | `installation_required` | AI Workflow is not installed in this repository; install it to continue. | runnable command |
26
- | `state_mismatch` | AI Workflow state files are inconsistent with each other; run diagnostics to inspect and repair. | runnable command |
27
- | `context_budget_exceeded` | The served context exceeds the declared ceiling for this stage; trim it or raise the ceiling explicitly. | explicit action |
28
- | `stage_not_in_process` | This stage does not exist in the active workflow's process; use the process's own stages. | explicit action |
29
- | `migration_required` | Legacy pre-ownership state detected; review the migration plan before continuing. | runnable command |
30
- | `worktrees_leaked` | Managed orchestration worktrees remain on disk after their plan finished; clean them up. | explicit action |
31
- | `orchestration_not_executed` | The plan has not been executed yet; there is no checkpoint to integrate. | explicit action |
9
+ | Reason code | Description | Continuation |
10
+ | ------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------- |
11
+ | `gate_evidence_missing` | The quality gate is blocked because the required evidence artifact is missing. | explicit action |
12
+ | `gate_incomplete` | The quality gate found completeness issues in the stage artifact. | explicit action |
13
+ | `stage_prerequisite_pending` | A previous stage is awaiting human approval before this stage can start. | runnable command |
14
+ | `stage_prerequisite_unresolved` | Previous stages need human approval or an accepted optional skip before this stage can start. | runnable command |
15
+ | `stage_awaiting_approval` | This stage is awaiting human approval; approve or reject it before continuing. | runnable command |
16
+ | `stage_already_approved` | This stage is already approved; changed evidence requires rerunning its quality gate. | runnable command |
17
+ | `approval_evidence_missing` | Approval cannot be recorded because the stage evidence artifact is missing. | explicit action |
18
+ | `approval_stale` | The artifact changed after review; its approval is stale and the gate must run again. | runnable command |
19
+ | `approval_gate_missing` | No passing quality gate is recorded for this stage; gate it before approving. | runnable command |
20
+ | `lane_escalation_required` | Light-lane workflows do not author stage artifacts; escalate to the full lane to continue. | explicit action |
21
+ | `light_evidence_missing` | A light-lane workflow cannot complete without at least one recorded validation entry. | explicit action |
22
+ | `workflow_still_active` | A workflow is already active; finish or archive it before starting another. | explicit action |
23
+ | `workflow_not_active` | No SDD workflow is active for this command to operate on. | runnable command |
24
+ | `workflow_complete` | This workflow is already complete; start a new workflow to continue working. | runnable command |
25
+ | `installation_required` | AI Workflow is not installed in this repository; install it to continue. | runnable command |
26
+ | `state_mismatch` | AI Workflow state files are inconsistent with each other; run diagnostics to inspect and repair. | runnable command |
27
+ | `context_budget_exceeded` | The served context exceeds the declared ceiling for this stage; trim it or raise the ceiling explicitly. | explicit action |
28
+ | `stage_not_in_process` | This stage does not exist in the active workflow's process; use the process's own stages. | explicit action |
29
+ | `migration_required` | Legacy pre-ownership state detected; review the migration plan before continuing. | runnable command |
30
+ | `worktrees_leaked` | Managed orchestration worktrees remain on disk after their plan finished; clean them up. | explicit action |
31
+ | `orchestration_not_executed` | The plan has not been executed yet; there is no checkpoint to integrate. | explicit action |
32
+ | `update_conflict` | Manually edited installed resources conflict with a bundled update; they are preserved, never overwritten. | explicit action |
@@ -41,6 +41,11 @@ Observed behavior on real plans: an evidence-free plan scored `gate: ready` with
41
41
 
42
42
  Decision-model output is `inferred` evidence with confidence, never `confirmed`. It can move an artifact to _pending review_, never to _approved_, and cannot replace the fingerprinted human approval ledger. This matches the existing approval contract and keeps the audit trail human-owned.
43
43
 
44
- ## Planned integration (OPP-007)
44
+ ## Implemented integration (OPP-007)
45
45
 
46
- The next planned decision-model roles follow the same contracts: findings-evidence triage for severe review findings (does the cited proof support the claim — advisory flag, the refuter still decides) and a lane scope-watch that flags mismatch between a chosen light lane and deterministic risk signals. Both stay advisory-only with the deterministic floor unchanged; unconfigured behavior is byte-identical. See [OPP-007](opportunities/OPP-007-decision-findings-triage-scope-watch.md).
46
+ Two advisory flows ship (see [OPP-007](opportunities/OPP-007-decision-findings-triage-scope-watch.md)):
47
+
48
+ 1. **Findings-evidence triage** — `aiw decision findings-triage --findings=<path>` always runs the deterministic shape check (severity present; proof references or `file:line` non-empty; unparseable input fails closed). When the decision model is enabled, one batched request asks "does the cited evidence support the claim?" per severe finding; answers are printed as advisory `evidence_supported: yes/no/unclear` flags and the refuter still owns corroboration/refutation. Provider failures degrade silently to shape-check-only output.
49
+ 2. **Lane scope-watch** — light-lane completion always records the deterministic tier-vs-lane mismatch advisory (`risk assess` high on a light lane) in the light checkpoint and completion output; when the model is enabled, one additional advisory scope question (multi-subsystem footprint) is printed. Both notes never block, never change lanes, never change tiers.
50
+
51
+ Routing categories `review.findings-triage` and `workflow.lane-watch` follow the evidence-linked routing contract: rules with evidence are `evidenced`, without evidence `unevidenced-rule`, absent rules fall back safely. Unconfigured decision settings mean byte-identical behavior and zero network requests.
@@ -1,6 +1,6 @@
1
1
  # OPP-007: Decision model — findings-evidence triage and lane scope-watch
2
2
 
3
- - Status: Proposed
3
+ - Status: Implemented
4
4
  - Priority: P3
5
5
  - Added: 2026-10-30
6
6
  - Decision: [ADR-001](../../.context/adrs/ADR-001-odd-rdd-proportionality-scope.md), Decision A (model-integration addendum)
@@ -1,6 +1,6 @@
1
1
  # OPP-008: Embedding retrieval — covering-test detection and judge context scoping
2
2
 
3
- - Status: Proposed
3
+ - Status: Implemented
4
4
  - Priority: P3
5
5
  - Added: 2026-10-30
6
6
  - Decision: [ADR-001](../../.context/adrs/ADR-001-odd-rdd-proportionality-scope.md), Decision A (model-integration addendum)
@@ -70,3 +70,12 @@ Without semantic mapping (or when the index is missing, built with another model
70
70
  ## Planned integration (OPP-008)
71
71
 
72
72
  The next planned retrieval consumers follow the same contracts: covering-test detection for `aiw risk assess` (a semantic hit prevents a false `untested_regression` flag; absence fails safe toward `high`) and judge context scoping for the adversarial review skills (bounded retrieved chunks labeled as context aids). Deterministic fallbacks are unchanged; unconfigured behavior is byte-identical. See [OPP-008](opportunities/OPP-008-embedding-covering-tests-judge-context.md).
73
+
74
+ ## Covering-test retrieval and judge context (OPP-008)
75
+
76
+ Two advisory flows consume the existing index — both fail safe and never change facts:
77
+
78
+ 1. **Covering-test retrieval** (`aiw risk assess`): for changed source paths without a sibling test, one scoped semantic query looks for test chunks exercising that module. A hit removes only the `untested_regression` reason (labeled `covering: semantic-retrieval` for audits); tiers stay rule-based and all other reasons stand. No config, no index, or an unreachable model → the deterministic sibling heuristic result is byte-identical.
79
+ 2. **Judge context scoping** (`aiw semantic judge-context --paths=a.ts,b.ts [--budget=N]`): renders changed paths plus top-k retrieved chunks under a bounded budget, each labeled as a context aid (retrieval — not a confirmed fact). Unavailable flows return an advisory error; judges fall back to the raw diff.
80
+
81
+ A stale index can only miss, which fails safe toward the existing flags. See [OPP-002](opportunities/OPP-002-risk-assess-command.md), [OPP-003](opportunities/OPP-003-adversarial-review-package.md), and [OPP-008](opportunities/OPP-008-embedding-covering-tests-judge-context.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multileaf/ai-workflow",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "Portable spec-driven development workflow for AI coding agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,65 @@
1
+ schema: 1
2
+ id: evaluator-draft-contract
3
+ family: evaluator
4
+ harness: codex
5
+ description: >
6
+ A real coding agent follows the resource-evaluator skill on a stack the
7
+ catalog does not cover: it must draft proposals grounded in the brief's
8
+ evidence (resolvable fact ids, real detected tooling), import them through
9
+ the CLI contract, and stop at the human gate — proposals stay pending and
10
+ no resource is materialized. Generic advice or self-approval fails.
11
+ command: codex exec --sandbox workspace-write {prompt}
12
+ prompt: |
13
+ Work in the current repository. The `aiw` CLI is installed and its workflow
14
+ skills are available under .aiw/resources/skills — read the
15
+ resource-evaluator skill before acting. `aiw evaluate` has already produced
16
+ .aiw/eval/signals.yml and .aiw/eval/brief.md for this project. Act as the
17
+ resource-evaluator skill directs: analyze the brief, then write one or two
18
+ proposals to .aiw/eval/proposals-draft.yml. Every proposal must follow the
19
+ draft contract exactly: kind (skill|agent|rule|hook|template), signature,
20
+ title, outline, and evidence citing fact ids that exist in the brief.
21
+ Outlines must reference this project's actually detected tooling — never
22
+ generic advice. Then run `aiw proposals import` and confirm it succeeds.
23
+ STOP there: proposals must remain pending human approval. Never approve,
24
+ reject, or suppress anything yourself, and never create files under
25
+ .aiw/generated. Finish the session cleanly.
26
+ fixture:
27
+ files:
28
+ - path: README.md
29
+ content: |
30
+ # scenario fixture
31
+
32
+ A Python/FastAPI service used by the evaluator behavioral scenario.
33
+ - path: pyproject.toml
34
+ content: |
35
+ [project]
36
+ name = "app"
37
+ dependencies = ["fastapi"]
38
+
39
+ [tool.pytest.ini_options]
40
+ testpaths = ["tests"]
41
+ - path: src/app/__init__.py
42
+ content: |
43
+ __all__: list[str] = []
44
+ - path: tests/test_app.py
45
+ content: |
46
+ def test_ok() -> None:
47
+ assert True
48
+ setup:
49
+ - aiw install
50
+ - aiw evaluate
51
+ git: false
52
+ expected:
53
+ exitCode: 0
54
+ files:
55
+ .aiw/eval/proposals-draft.yml:
56
+ contains: "kind:"
57
+ .aiw/proposals.yml:
58
+ contains: "status: proposed"
59
+ notContains: "status: approved"
60
+ dirs:
61
+ .aiw/generated:
62
+ absent: true
63
+ budget:
64
+ wallClockS: 300
65
+ tokenCeiling: 150000
@@ -28,10 +28,12 @@ resources:
28
28
  - { id: documentation-maintenance, version: 0.1.0, path: skills/documentation-maintenance.md }
29
29
  - { id: adapter-development, version: 0.1.0, path: skills/adapter-development.md }
30
30
  - { id: skill-authoring, version: 0.1.0, path: skills/skill-authoring.md }
31
+ - { id: resource-evaluator, version: 0.1.0, path: skills/resource-evaluator.md }
31
32
  - { id: nestjs-development, version: 0.1.0, path: skills/nestjs-development.md }
32
33
  - { id: prisma-data-access, version: 0.1.0, path: skills/prisma-data-access.md }
33
34
  - { id: vite-frontend, version: 0.1.0, path: skills/vite-frontend.md }
34
35
  - { id: ticket, version: 0.1.0, path: skills/ticket.md }
36
+ - { id: research, version: 0.1.0, path: skills/research.md }
35
37
  - { id: review-judge-a, version: 0.1.0, path: skills/review-judge-a.md }
36
38
  - { id: review-judge-b, version: 0.1.0, path: skills/review-judge-b.md }
37
39
  - { id: review-refuter, version: 0.1.0, path: skills/review-refuter.md }
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: research
3
+ description: Run a bounded, evidence-first investigation from a single question — logs, errors, code, or external sources — and record a durable research artifact.
4
+ ---
5
+
6
+ # Research (bounded, evidence-first)
7
+
8
+ Use this skill when work starts from a concrete question that needs context gathered before anything is decided or designed: an unexplained error, a log signature, a migration implication, a library behavior. This skill collects and sharpens context; it never decides, designs, or replaces diagnosis/brainstorming.
9
+
10
+ ## Scope gate (before any work)
11
+
12
+ 1. Restate the request as **one investigable question**. If the request bundles several questions or is vague, ask the human to confirm a single question and stop until they do.
13
+ 2. List the **explicit sources**: file paths, log locations, a reproduction command, or external documentation areas. No source list, no start.
14
+ 3. If the question turns out to need a fix or a decision rather than facts, stop and suggest the right lane: `aiw task start --process=bugfix` (diagnosis) or a brainstorm/specification workflow.
15
+
16
+ ## Budget and stop conditions
17
+
18
+ - Cap the investigation at a fixed budget: at most ~10 investigation steps or 3 turns, whichever comes first.
19
+ - Stop and converge when either: two independent sources confirm the answer, or the budget is exhausted.
20
+ - On stop, report what was verified, what remains open, and the budget usage. Never continue "just a bit more" past the cap.
21
+ - If scope grows beyond the question mid-flight, stop and escalate (`aiw task escalate --reason=...` in a light-lane session, or suggest a full workflow) instead of widening the investigation.
22
+
23
+ ## Evidence rules (every finding)
24
+
25
+ - Every finding cites a **verifiable source**: `file:line`, a log line with its timestamp, or a URL with the consultation date.
26
+ - Mark each finding's state: **fact** (source directly states it), **hypothesis** (inferred, cited basis named), or **unverified** (no source yet — belongs in open questions, not findings).
27
+ - A claim without a verifiable citation is an **open question**, never a finding.
28
+ - Prefer the repository's own evidence first: `aiw semantic query <terms>` when semantic mapping is enabled, exact `grep`/`rg` for literals, logs and reproduction commands before external sources.
29
+
30
+ ## External research (host-side)
31
+
32
+ - You (the host agent) perform any web or documentation searches; AIW does no network calls.
33
+ - **Redact secrets before querying or persisting**: tokens, credentials, internal hostnames, and anything the interpreter guardrails would exclude must not appear in queries, excerpts, or the artifact.
34
+ - Record each external source as URL + consultation date in the artifact's source list.
35
+
36
+ ## Artifact
37
+
38
+ Write the result to `.aiw/generated/reports/<workflowId>/research.md` with exactly these sections:
39
+
40
+ ```markdown
41
+ # Research: <question>
42
+
43
+ ## Question
44
+ <the single confirmed question>
45
+
46
+ ## Sources
47
+ - <file:line / log location / reproduction command / URL + consultation date>
48
+
49
+ ## Findings
50
+ - <finding> — state: fact|hypothesis — source: <citation> — confidence: high|medium|low
51
+
52
+ ## Budget
53
+ steps used: <n> / cap · stop reason: <confirmed|budget>
54
+
55
+ ## Open questions
56
+ - <unresolved items, next most-likely source>
57
+ ```
58
+
59
+ Confidence uses the scan evidence vocabulary (high/medium/low). Then record completion in the session:
60
+
61
+ - Light-lane session: `npx --yes --package=@multileaf/ai-workflow -- aiw task evidence --validation="research artifact: .aiw/generated/reports/<workflowId>/research.md (<findings count> findings, <open count> open)"`.
62
+ - No active workflow: start one first — `aiw task start --no-ticket --lane=light --lane-reason="bounded research, resumable from request plus artifact"` — artifact paths are workflow-scoped.
63
+
64
+ The artifact feeds later stages (brainstorm, specification, diagnosis); cite it rather than re-reading sources.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: resource-evaluator
3
+ description: Analyze a project evaluation brief and draft evidence-backed resource proposals.
4
+ ---
5
+
6
+ # Resource Evaluator
7
+
8
+ Read the brief at `.aiw/eval/brief.md` (produced by `aiw evaluate`) and draft
9
+ resource proposals for this specific project. Propose only what the evidence
10
+ supports; never generic advice.
11
+
12
+ ## Contract
13
+
14
+ - Write drafts to `.aiw/eval/proposals-draft.yml` as a YAML list; write nothing else.
15
+ - Each record defines `kind` (skill | agent | rule | hook | template),
16
+ `signature` (stable slug for the motivating pattern), `title`, `outline`,
17
+ and `evidence` (signal fact ids from the brief).
18
+ - Ground every outline in the detected tooling (build/test commands, frameworks,
19
+ conventions). Cite the fact ids that justify the resource.
20
+ - Skip resources that duplicate existing project or catalog resources; when
21
+ unsure, prefer one high-evidence proposal over many weak ones.
22
+ - After writing, tell the user to run `aiw proposals import` so the CLI can
23
+ validate the contract (dangling evidence refs are rejected) before anything
24
+ reaches the approval gate.
@@ -22,3 +22,7 @@ You are one of two independent reviewers. Review the change **without consulting
22
22
  ## Output
23
23
 
24
24
  Emit a numbered findings list (severity, evidence, impact) and a final line: `Inspection complete: <files/paths examined>`.
25
+
26
+ ## Optional retrieval aid
27
+
28
+ When `aiw semantic judge-context --paths=<changed paths>` is available (semantic mapping enabled with an index), you may include its output as context. Retrieved chunks are context aids, never confirmed facts, and never substitute for `file:line` evidence.
@@ -22,3 +22,7 @@ You are the second independent reviewer. Your pass must be fresh: **do not read,
22
22
  ## Output
23
23
 
24
24
  Emit a numbered findings list (severity, evidence, impact) and a final line: `Inspection complete: <files/paths examined>`.
25
+
26
+ ## Optional retrieval aid
27
+
28
+ When `aiw semantic judge-context --paths=<changed paths>` is available (semantic mapping enabled with an index), you may include its output as context. Retrieved chunks are context aids, never confirmed facts, and never substitute for `file:line` evidence.
@@ -26,3 +26,7 @@ A severe finding with neither a reproducing command nor self-proving `file:line`
26
26
  - Never refute a claim you were not given; one verdict per issued claim.
27
27
  - Pre-existing, base-only, or unknown-causality findings are not yours to drop: mark them `inconclusive` and pass them on.
28
28
  - A human still accepts the final review outcome; your verdicts are evidence, not approval.
29
+
30
+ ## Optional retrieval aid
31
+
32
+ When `aiw semantic judge-context --paths=<changed paths>` is available (semantic mapping enabled with an index), you may include its output as context. Retrieved chunks are context aids, never confirmed facts, and never substitute for `file:line` evidence.
@@ -17,4 +17,4 @@ Lane decision (light lane): before starting, apply the resume test — the work
17
17
  4. Continue the standard SDD sequence: technical design when the change has architecture impact (`aiw adr`, gate, approval), implementation plan (`aiw plan`, gate, approval), TDD implementation, verification (`aiw verify`, gate, approval), code review, and traceability (`aiw trace`, gate, approval). Check progress at any point with `npx --yes --package=@multileaf/ai-workflow -- aiw task status`, which reports the ticket and the next pending stage.
18
18
  5. Complete with `npx --yes --package=@multileaf/ai-workflow -- aiw workflow complete` only after all stages resolve; the ticket reference stays in the archived session and the specification.
19
19
 
20
- Never invent a ticket ID: if the user did not provide one, ask for it (or offer the plain `aiw workflow start` flow). Never skip brainstorming without an explicit human acceptance recorded through `aiw skip brainstorming`. Use `npx --yes --package=@multileaf/ai-workflow -- aiw <command>` when no global CLI is available.
20
+ Never invent a ticket ID: if the user did not provide one, ask for it — or, with the user's consent, start without `--ticket` so the CLI self-serves a local ticket (for example `LOCAL-001`), or offer the plain `aiw workflow start` flow. Never skip brainstorming without an explicit human acceptance recorded through `aiw skip brainstorming`. Use `npx --yes --package=@multileaf/ai-workflow -- aiw <command>` when no global CLI is available.