Learn
The Learn domain closes the loop of the Agentic Software Factory. It watches what a release does in production, turns incidents, verdicts, and early warnings into validated records, and opens backlog issues in Triage for what it finds. It also keeps Persistent Context healthy and feeds the weekly and monthly reviews.
AI proposes and drafts. Humans decide. The QA and maintainer confirms causes and decides mitigation. The Product Owner decides every hypothesis verdict. Coding Pal enforces that split mechanically: the ledger tool never writes a verdict, and an incident record or a verdict without a named person and role is invalid.
Domain Architecture
Capabilities Matrix
| Capability | Invocation / Entry Point | Specialist Agent | Scoping Instruction | Supporting Skill | Output Artifact |
|---|---|---|---|---|---|
| Predictive Monitoring (Detect / Explain) | The Learn Analyst in detect/explain mode, or telemetry-scan.mjs in CI | Learn Analyst | learn | telemetry-scan | Findings (text or JSON) with evidence and the deploys before the onset |
| Outcome Review | /outcome-review | Learn Analyst (verdict mode) | learn | hypothesis-ledger | Due hypotheses with proposed verdicts and maths, validation and deletion rates (no files written) |
| Hypothesis Ledger | ledger.mjs add and validate | Learn Analyst | learn | hypothesis-ledger | specs/learn/hypotheses.md |
| Incident Record | /incident | Learn Analyst (incident and harden modes) | learn | incident-record | docs/incidents/<date>-<slug>.md |
| Persistent Context & Controls Review | /context-review | Learn Analyst (context mode) | learn | context-health | Lint report, proposed artifacts, control findings (no files written) |
| Close the Loop | emit-learn-issues.mjs | Learn Analyst (emit mode) | learn | learn-signals | signal-*.md issue bodies and signals.json |
| Meeting Pre-Reads & Retrospective | /pre-read, /operating-retro | Learn Analyst (review-pack mode) | learn | hypothesis-ledger, context-health | Pre-read or retrospective pack (no files written) |
Capability Workflows
1. Predictive Monitoring (Detect / Explain)
- When to Run: Continuously on exported telemetry, after a release, and whenever a signal looks odd.
- Why Deterministic: The scan reads exported files, so the same series gives the same findings. It holds no production credentials and queries nothing.
- Workflow Steps:
- Detect: The scan compares the series with a baseline (supplied, or the first 60% of the series) and with thresholds.bash
node .agents/skills/telemetry-scan/scripts/telemetry-scan.mjs \ --series series.json --thresholds thresholds.json --deploys deploys.json --json > findings.json - Explain: Each finding lists the deploys within 60 minutes before its onset. The
Learn Analystcorrelates them with logs and diffs and proposes a cause. - Act (human): The QA and maintainer confirms the cause and decides whether to mitigate. The rollback thresholds in Release still trigger automatic rollback on their own.
- Detect: The scan compares the series with a baseline (supplied, or the first 60% of the series) and with thresholds.
What the Scan Reports
| Finding | Rule | Severity |
|---|---|---|
anomaly | The last 3 points all have |z| >= 3 against the baseline | high at |z| >= 5, otherwise medium |
breach | The current value is beyond a threshold | high |
trend | The least-squares slope over the last 10 points heads toward a threshold and the ETA is within the horizon (default 120 minutes) | high within half the horizon, otherwise medium |
Exit codes: 0 scanned, 1 invalid input, 3 at least one high finding so CI can alert. Monitoring informs, humans act: the exit code never blocks unrelated work.
2. Outcome Review and the Hypothesis Ledger
- When to Run: Before the weekly Outcome review, and when a work item that named an outcome metric ships.
- Workflow Steps:
- Register: When the work item ships, add an
Openrow.bashnode .agents/skills/hypothesis-ledger/scripts/ledger.mjs add --file specs/learn/hypotheses.md --issue 42 \ --hypothesis "Order templates shorten order entry" --metric "Minutes per order" \ --baseline 6 --target 3 --direction down --watch-ends 2026-11-30 - Due:
ledger.mjs duelistsOpenrows past their watch end andInvalidatedrows whose feature is not deleted within the cycle (14 days by default). - Propose:
ledger.mjs propose --issue 42 --observed 3.4prints a proposed verdict with the maths and the suggested actions. It writes nothing. - Decide: The Product Owner records the verdict, the action, the evidence, and
<name> (Product Owner) on YYYY-MM-DDin a pull request. - Delete: An
Invalidatedfeature is deleted and the row recordsDelete feature (Deleted <date>). - Measure:
ledger.mjs statsreports the hypothesis validation rate and the feature deletion rate. A validation rate near 100% is a warning, not a success.
- Register: When the work item ships, add an
| Verdict | Condition for the proposal | Next action |
|---|---|---|
| Validated | progress >= 1 | Remove flag or Invest further |
| Inconclusive | No movement, or short of the target | Iterate once or Remove |
| Invalidated | progress < -tolerance (moved against us) | Delete feature |
progress = (observed - baseline) / (target - baseline). Because the direction always agrees with the numbers, one formula covers metrics that should rise and metrics that should fall.
What the Ledger Validator Enforces
| Check | Why |
|---|---|
Exact columns, unique #<issue>, numeric baseline and target | A comparable, machine-readable ledger |
Direction agrees with baseline and target | The proposal maths cannot flip silently |
Non-Open verdict needs Evidence, an allowed Action, and Decided | No verdict without evidence and a decision |
Decided is <name> (Product Owner) on <date>, on or after the watch end | Only the Product Owner decides, and not before the window ends |
Invalidated carries Delete feature (Pending) or (Deleted <date>) | Dead features do not linger |
3. Incident Record
- When to Run: After mitigation, for every incident, and for a rollback or near-miss worth a review.
- Workflow Steps:
- Detect and mitigate first: Flag off, roll back, or fix forward. Mitigation precedes diagnosis.
- Draft:
/incident notes/checkout-outage.md. TheLearn Analystdraftsdocs/incidents/<YYYY-MM-DD>-<slug>.mdfrom the timeline notes, correlates logs, traces, deploys, and diffs, and proposes the cause. The QA and maintainer concludes. - Repair test first: A test reproduces the defect and fails, then the fix makes it pass. The test commit precedes the fix commit.
- Validate:bash
node .agents/skills/incident-record/scripts/validate-incident.mjs \ --file docs/incidents/2026-10-13-checkout-5xx.md --tests-dir tests - Review within five working days, and record what should have caught it.
- Harden: Every defect, rollback, or near-miss is asked: what reached production that a control should have caught? Add a guard, gate, contract, or probe, or an earlier probe when the signal came too late.
What the Incident Validator Enforces
| Check | Why |
|---|---|
| Exact sections in order | Predictable for readers and for the emitter |
Detected <= Mitigated <= Resolved, Diagnosis Started At >= Mitigated At | Mitigation precedes diagnosis |
Evidence mentions logs, traces, deploys, or diffs; Concluded By and Rollback Decided By name a person and a role | AI correlates, humans conclude |
Reproducing Test path (exists under --tests-dir), failed before, passes after, test commit before fix commit | A failing test first |
Review Date on a weekday within 5 working days after Resolved At | The review happens |
Typed Control Hardening items or None: <reason>; Triage Issue consistent with them; owners on postmortem actions | A loss hardens a control or says why not |
| Time to restore printed against the target of under 15 minutes | A metric, reported and not enforced |
4. Close the Loop: Learn Signals
- When to Run: At the end of an incident review, at the weekly Outcome review, and after a telemetry scan.
- Why: The loop closes only when a Learn output becomes a backlog issue in Triage.
- Workflow:bashOnly validated inputs are emitted. Each issue gets the labels
node .agents/skills/learn-signals/scripts/emit-learn-issues.mjs --out learn-signals \ --incident docs/incidents/2026-10-13-checkout-5xx.md \ --ledger specs/learn/hypotheses.md --findings findings.jsonneeds:triageandsource:learn, a<!-- learn-signal: <kind>:<id> -->marker, and the sections## Problem Statement,## Evidence(typeincident,hypothesis-verdict, ortelemetry),## Draft Acceptance Criteria, and## Source.
| Source | Becomes |
|---|---|
| Incident | One issue per Control Hardening item, plus a follow-up to lift a flag off or rollback mitigation |
| Invalidated hypothesis | An issue to delete the feature |
high telemetry finding | An investigation issue |
CI Pattern
- Idempotent: The marker is the key. An existing issue with the same marker is never recreated or edited.
- Human gate: The emitter drafts. Triage proposes and the Product Owner decides.
- Draft stage for incidents: Records are validated at the
draftstage soTriage Issue: Pendingis accepted until the number is known. CI validates thefinalstage.
5. Persistent Context & Controls Review
- When to Run: Before the weekly review (Architect and Developer), and in CI on changes to instruction files.
- Workflow:
/context-reviewruns the health lint and the corrections proposals.bashnode .agents/skills/context-health/scripts/context-lint.mjs --root . --baseline context-baseline.json node .agents/skills/context-health/scripts/context-corrections.mjs add --log specs/learn/corrections.jsonl \ --topic "Use named exports" --source "PR #123" node .agents/skills/context-health/scripts/context-corrections.mjs propose --log specs/learn/corrections.jsonl - Evidence-driven: A topic corrected or re-explained twice, with no artifact, becomes a proposed artifact. The log is append-only.
- Control signal-to-noise: The user supplies how often each control fires and is bypassed. The agent reports it and never invents it. A control that is routinely bypassed is fixed or removed.
What the Lint Reports
| Rule | Severity | Why |
|---|---|---|
Missing description; applyTo of ** or empty (unless allowlisted in the baseline) | error | Instructions are small, specific, and scoped precisely |
| References to skills, agents, or prompts that do not exist | error | Deleted when wrong |
| Secret-looking strings (cloud keys, private keys, tokens) | error | Context never contains secrets |
| Instruction longer than 120 lines | warning | The everything instruction gets ignored |
| Near-duplicate instructions (line overlap >= 60%) | warning | One rule, one place |
| Not committed for 180 days (inside a git repository) | warning | An outdated instruction is worse than none |
| Instruction count grew more than 20% over the baseline | warning | Growth without pruning is a health signal |
6. Pre-Reads and the Operating Retrospective
When to Run: Before each recurring meeting. Pre-reads are AI-drafted and circulated ahead of time, and meetings are reserved for debate and decisions.
Workflow:
/pre-read outcome-review(ortriage-review,context-review,operating-retro) collects the artifacts and metrics for that meeting and writes nothing./operating-retro metrics/events.jsonl --since 2026-09-01builds the monthly pack from the report of.agents/skills/flow-metrics/scripts/flow-metrics.mjs --events <events.jsonl> [--since YYYY-MM-DD], plus the hypothesis rates and the incident time to restore. If the metrics report is not available, the agent asks for it and computes nothing by hand.Falsifiable Done When:
ledger.mjs validateexits 0 onspecs/learn/hypotheses.md, and no verdict was written by AI.validate-incident.mjsexits 0 on each incident record, with--tests-dir, and the cause and rollback decision name a person and role.telemetry-scan.mjsexits 0 or 3 on the supplied exports, never 1, and nothing was changed in production.emit-learn-issues.mjsexits 0 andsignals.jsonlists every control hardening item, undeleted invalidated feature, andhighfinding.context-lint.mjsexits 0 on the repository.- Zero code was modified during Learn.