Skill: Learn
Integrate lessons learned from build execution into the project's durable
specification and design documentation. The inputs are what the build process
has discovered (plan/incoming/learnings/ — individual per-entry files) and
open GitHub type:Concern issues tracked in the repository; the output is
refined specs/, notes/, and AGENTS.md.
Constraint: Modify documentation files only, including Markdown files,
YAML spec files in specs/, and (conditionally for small in-session
translations) docs/. Do not modify code or tests.
Trigger: Use this skill when plan/incoming/learnings/ has unprocessed
entries that should be promoted into durable docs.
For new external ideas (GitHub Idea-type issues), use
plan-issueinstead.
Quick Start
- Ensure synced (before any writes):
manage_worktree.sh ensure-synced - Invoke
acquire-codebase-knowledge— full scan, refreshes all 7 docs
in docs/reference/codebase/.
- Read all files in
plan/incoming/learnings/and query GitHub for open
type:Concern issues (both are input queues).
- Invoke
orient-agentthendeepen-contextfor full context (spec map and
governing specs, notes, code) — it now reads the freshly updated codebase
docs.
- Analyze what the build process has learned vs. what specs and notes capture.
- Invoke
grill-meto align on scope and decisions — before writing anything.
Include GitHub Concern issue triage in this phase (no separate triage step
needed).
- Create the task branch:
git switch -c learn/<YYYYMMDD>-<slug>
(worktree was already synced in step 1; branch here after slug is known)
- Write to
specs/,notes/, andAGENTS.md. - Archive each processed incoming learning file via
uv run append-history --from-file <path> (which moves the file to
plan/history/YYMM/learning/ and deletes the source).
Archive each resolved Concern issue via uv run append-history learning
and close the issue with a resolution comment.
- Invoke
format-markdown. - Commit (including updated
docs/reference/codebase/files), push, and
open a docs-only PR with specs-notes label.
Workflow
Phase 0 — Sync and Refresh Codebase Knowledge
First, ensure the worktree is synced to origin/main before any file
writes:
bash .agents/skills/shared/sync-check.sh
If that script is absent, verify git rev-list HEAD..origin/main returns 0
before continuing.
Do this before acquire-codebase-knowledge runs — the scan regenerates
files in docs/reference/codebase/ (uncommitted), and those outputs must not
be clobbered by a later git reset --hard.
Then invoke the acquire-codebase-knowledge skill (full scan, no focus area
restriction). This regenerates all seven files in docs/reference/codebase/
from the current state of the repository before any gap analysis begins,
ensuring orient-agent in Phase 1 reads an accurate baseline.
Always run this phase unconditionally — learn runs infrequently enough
that the cost of a full scan is justified on every invocation.
Phase 1 — Load Internal Sources and Context
- Read all files in
plan/incoming/learnings/— open questions, observations,
and constraints from recent build/bugfix runs (ephemeral queue; files are
moved to plan/history/YYMM/learning/ after archiving).
- Query GitHub for all open
type:Concernissues — these are the tracked
technical concerns, risks, and debt items surfaced by prior codebase scans
and the process-concerns skill (second input queue; resolved issues are
archived and closed):
```bash
gh issue list \
--repo CERTCC/Vultron \
--state open \
--limit 1000 \
--json number,title,body,issueType \
--jq '.[] | select(.issueType.name == "Concern")'
```
Select on the issue type, not a concern label — the type is
authoritative (see notes/parallel-development.md § "GitHub Issue Tracker"),
and the two do not agree: the label matches 13 open issues where the type
matches 53.
reflect-cycle gates this same queue on the type, so a label query here
makes the two skills disagree about whether learn has input.
- Invoke
orient-agentthendeepen-contextfor full context: the spec map
plus the specs governing the learnings and Concerns in scope, plan files,
notes/, AGENTS.md, and a code scan. deepen-context routes through
decision records by title and adr: edge only, so read in full any record
body this run writes to (Phase 4 below). Because Phase 0 has already
refreshed the codebase docs, orient-agent/deepen-context will read
up-to-date architecture and structure information.
plan/incoming/learnings/is an ephemeral queue. Files are moved to
plan/history/YYMM/learning/after archiving. Any critical insight
in an entry must be promoted to
specs/ornotes/before being
archived.
Phase 2 — Analyze Gaps and Staleness
See .claude/skills/shared/completeness-doctrine.md for the project standard
on what constitutes a complete lesson — loaded by orient-agent in Phase 1.
This phase runs in both directions: what is missing from durable docs
(additions), and what in notes/ is now stale (removals). Both feed the
grill-me interview in Phase 3.
Part A — Find Gaps (additions)
Identify what the build process and codebase scan have surfaced that is not
yet captured in durable docs. Consider both incoming learning files and
open GitHub Concern issues.
Prioritise by signal type. Learning files tagged with signal: in their
frontmatter carry higher-urgency signals and MUST be addressed before general
pattern promotion. Process in this order:
signal: spec-gap— behaviour in code with no spec entry. Before writing,
ask: **Would a participant running a different implementation of the protocol
notice if this requirement were violated?** If no → route to AGENTS.md, not
specs/. If yes → write the missing spec requirement.
signal: spec-contradiction— two requirements that conflict. Resolve the
conflict and update both affected spec entries.
signal: spec-ambiguity— requirement was unclear; an interpretation was made
during build. Clarify the requirement so future agents don't have to guess.
signal: theme-candidate— a general claim the author could not verify from
one instance. Do not promote it on its own authority (BW-07-005). Group
candidates by claim and count independent witnesses — entries with
different source work items asserting the same thing:
- Two or more witnesses → the claim is corroborated. Promote to
notes/
or AGENTS.md, or file an issue through create-issue if it names a
defect, typed by shared/issue-creation-requirements.md § "Determining
the right values".
- One witness → try to confirm it against the code. If confirmed,
promote. If not, leave it queued.
- One witness, older than 30 days → archive as unreproduced via
append-history learning, with no promotion (BW-07-007). Note the
non-reproduction in the archive body.
- Retired signal values (
design-question,concern,tooling-issue,
process-issue) should no longer appear on new entries — those findings are
now routed to a GitHub issue or an in-session fix at discovery (BW-07-004).
If you encounter one on a pre-existing entry, treat it per its destination in
that table: file the issue or apply the fix now, then archive the entry.
- Untagged entries — general observations and patterns:
- Missing requirements — behavior exists in code but has no spec.
- Ambiguous or untestable requirements — reality diverges from what's written.
- Redundant or contradictory requirements across spec files.
- Agent guidance patterns that keep recurring but are not yet in
AGENTS.md.
- Open GitHub
type:Concernissues that reveal missing spec requirements or
durable design notes.
- Recent completed-task insights — when needed, run `uv run show-history
--month YYMM` to identify which history entries contain architectural
lessons, then open those entry files.
A lesson is not complete until it has reached a durable destination: a specs/
requirement, a notes/ card, an AGENTS.md entry, a filed GitHub issue, or an
explicit non-reproduction verdict. If an entry clearly warrants a spec or notes
update that cannot be written in this session, document why and create a Concern
issue through create-issue — do not silently archive it as if nothing were
owed. Every issue this skill files goes through create-issue.
Two archive outcomes are legitimate without promotion, and both must be stated
in the archive body rather than left implicit:
- Unreproduced — a single-witness
theme-candidateolder than 30 days with
no corroboration (BW-07-007).
- Already closed — the entry's substance is already tracked in a GitHub
issue, or already landed in specs/, notes/, docs/, or the code. Verify
the claim before accepting it; an entry asserting "tracked as #N" is only
discharged if #N actually covers it.
Part B — Notes Staleness Review (removals)
Start from uv run notes-tracks: every plan note it flags (all tracked
issues closed) is on the agenda. Then, for each notes/*.md file, review its
sections (cards) against the current codebase using the codebase knowledge
refreshed in Phase 0, and against the kind and trim rules in
.agents/skills/shared/notes-writing-guide.md (NF-08). A section that fits
neither its note's kind nor any other is mis-homed: split it out, move it
to docs/, or archive it. Assign each section one of three verdicts:
- Keep — still active guidance, well-homed
- Archive →
plan/history/YYMM/note/— section is stale - Promote →
docs/— section contains info that should be in docs/ but isn't
Archive signals — any one is sufficient, but signal (c) requires (a) or (b) to
also fire:
- (a) Delivered: the section describes building something that the codebase
scan confirms is now implemented
- (b) Redundant: the section's content is already captured in
specs/,
an ADR, or AGENTS.md — the notes version adds nothing
- (c) Closed linked item: the section references an issue/concern that is
now closed, AND signal (a) or (b) also fires
- (e) Confusion-resolved: the section explains something confusing that the
current code makes obvious
Age alone (signal d) is a tie-breaker only — "old" does not mean "stale."
Promote signals:
- The section contains durable conceptual or reference material that belongs
in docs/ for user-facing or developer-facing audiences, but no docs/
page currently covers it.
Promote disposition — apply the small/large heuristic:
- Small (translate now): an existing
docs/target file already covers
the topic AND the content transfers with light editing only (tone/audience
adjustment, no restructuring). Write to docs/ in Phase 5, then archive
the notes section.
- Large (defer): a new
docs/page would be needed, OR significant
rewriting/synthesis is required. File a type:Task issue capturing the
gap and the target location; keep the notes section active until resolved.
- Ambiguous: present the choice to the user during the Phase 3 interview.
Bring both the gap list (Part A) and the staleness/promote candidates (Part B)
into the Phase 3 grill-me interview as a combined agenda.
Phase 3 — Interview with Grill-Me
Invoke the grill-me skill, following .agents/skills/shared/asking-the-user.md
and its pre-ask check: ask what behavior a rule should require, not how to word it.
Resolve one question at a time (ask_user for discrete choices)
with a recommended answer before writing anything:
- Which insights from
plan/incoming/learnings/are most important to promote? - Which open GitHub
type:Concernissues are addressed by this session's
insights, outdated, or should be promoted to specs/notes? (Resolved
concerns go to specs/ if they reveal missing requirements, notes/
otherwise.)
- Which gaps are most critical to close in this run?
- Are there unresolvable conflicts that need a human decision?
- Does any spec change require code verification first?
Answer questions from codebase exploration where possible.
After grill-me completes — create the task branch before writing any files:
git switch -c learn/<YYYYMMDD>-<slug>
The worktree was already synced to origin/main in Phase 0. All file writes (Phases 4–7)
happen on this branch so they are never at risk from a git reset --hard.
Phase 4 — Refine Specifications (`specs/`)
- Clarify, split, merge, or remove requirements; keep each atomic, specific,
concise, and verifiable.
specs/are for what, not how.- Eliminate redundancy; use
PROD_ONLYtag for production-only requirements. - Separate topics of concern into distinct files when a file has grown too
broad.
- Update
specs/README.mdto reflect all file additions, removals, renames,
and topic reorganizations.
ADR decision (MS-11): When adding new spec entries, apply the decision-tree
heuristic in notes/specs-vs-adrs.md to decide whether the underlying design
choice also warrants a new ADR. Write an ADR when a meaningful alternative was
evaluated and rejected; skip it for uncontested rules (MS-11-002, MS-11-005).
When both are created, cross-reference them: cite the ADR in the spec's per-requirement
rationale field (per MS-11-004 — not the spec-group description), and list the
generated spec IDs in the ADR's "More Information" section (MS-11-010).
Read the body of every record you cross-reference before you edit it, and weigh
it by .agents/skills/shared/weighing-decision-records.md.
Phase 5 — Update Design Notes (`notes/`) and `docs/`
- Write per
.agents/skills/shared/notes-writing-guide.md: lasting rules go
into a kind: guidance note as rule + reason + one citation, never the
backstory; design for unbuilt work goes into a kind: plan note with
tracks:. Never add a plan item to a guidance note. Do not duplicate
spec text.
- Mark unresolved items explicitly:
Open Question:/Design Decision:. - Update
notes/README.mdwhen files are added, removed, or reorganized. - Every
notes/*.md(exceptnotes/README.md) must have valid YAML
frontmatter with title, status, and kind (NF-01).
Archive stale sections confirmed in the Phase 3 interview:
For each section with an Archive verdict, remove the section from its
notes/*.md file and archive it to plan/history/YYMM/note/ using
append-history note:
cat <<'BODY' | PYTHONPATH= uv run append-history note \
--title "<section heading>" \
--source "NOTES-<file-stem>--<section-slug>"
**Archived:** YYYY-MM-DD
**Reason:** <which signal fired — delivered/redundant/confusion-resolved>
**Superseded by:** <code path, spec ID, or docs page>
---
<original section content verbatim>
BODY
Source ID convention: NOTES-<file-stem>--<section-slug> where file-stem
is the notes filename without extension and section-slug is the section
heading kebab-cased (e.g. NOTES-bt-pitfalls--bt-failure-reason-propagation).
If archiving a section empties the file entirely, remove the file and update
notes/README.md to remove its entry.
Translate small Promote sections to docs/ confirmed in the Phase 3
interview (small = existing target file + verbatim-friendly edit only):
Write the translated content to the target docs/ file, then archive the
notes section as above. For large Promote candidates (new page needed or
significant rewrite), file a type:Task issue instead and leave the
section active.
Phase 6 — Update Agent Guidance (`AGENTS.md`)
Promote recurring implementation patterns and conventions from
plan/incoming/learnings/ into AGENTS.md. Keep entries precise, actionable,
and minimal.
Phase 7 — Prepare Archive Content and Close Processed Entries
For each incoming learning file and each resolved GitHub Concern issue that
has been fully promoted to specs/, notes/, or AGENTS.md:
- For incoming learning files: run `uv run append-history --from-file
<path> — this moves the file from plan/incoming/learnings/` to
plan/history/YYMM/learning/, deletes the source, and regenerates the
monthly README. Add a promotion note to the end of the body before
calling append-history --from-file (edit the file in-place):
```text
Promoted: YYYY-MM-DD — captured in <destination file(s)>.
Docs PR: <PR_URL>. ← filled in after PR is opened
```
- For resolved GitHub Concern issues: draft the archive body
(store in memory — the actual archive-history invocations happen in
Phase 9 after the PR URL is known):
```text
TYPE = learning
TITLE = <short concern title>
SOURCE = CONCERN-<ISSUE_NUMBER>
BODY = Full original concern body
- "Resolved: YYYY-MM-DD — captured in <destination file(s)>."
- "Docs PR: <PR_URL>." ← filled in after PR is opened
```
- For resolved GitHub Concern issues: close the issue and add a
resolution comment after the PR is open (step in Phase 9):
```bash
gh issue comment "${ISSUE_NUMBER}" --repo CERTCC/Vultron \
--body "✅ Resolved.
- Docs PR: <PR_URL>
- Promoted to: \
specs/<topic>.yaml\and/or \notes/<topic>.md\
Design decisions are now captured in durable documentation."
gh issue close "${ISSUE_NUMBER}" --repo CERTCC/Vultron
```text
Do not reference plan/incoming/learnings/ from durable docs.
Phase 8 — Lint, Commit, and Open PR
- Invoke the
format-markdownskill on all new/modified markdown files.
Fix all errors.
- If a requirement conflict cannot be resolved, create a learning file in
plan/incoming/learnings/ and stop before committing.
- Stage and commit (branch was created at the end of Phase 3):
```bash
git add specs/<changed-files> notes/<changed-files> AGENTS.md \
plan/incoming/learnings/ docs/reference/codebase/ \
plan/history/ docs/<changed-files-if-any>
```
Commit per commit/SKILL.md conventions. Subject format:
docs: promote learnings — <topic>. Use multiple commits for thematically
distinct changes (spec refinements, notes promoted, AGENTS.md updates).
Then invoke the create-pr skill:
```text
type: docs
title: docs: promote learnings — <topic>
body: <composed per pr-body-guide.md docs template>
labels: specs-notes
issue_number: <issue if applicable; omit if none>
```
create-pr performs the rebase on origin/main, runs linters, pushes, and
returns the PR URL. Use the returned URL when filling in the Docs PR:
field in the archive bodies (Phase 9).
- Invoke
check-docs-syncwhile CI runs in the cloud to confirm alldocs/
updates have been applied (PD-03-008). Because learn already handles
docs/ inline in Phase 5, this is a consistency check — if the skill
identifies additional pages, apply them and push an additional commit before
Phase 9.
Phase 9 — Archive Entries and Close Issues
Now that the PR URL is known:
- For each incoming learning file: edit it in-place to add the final
PR URL to the promotion note (appended in Phase 7), then run:
```bash
uv run append-history --from-file plan/incoming/learnings/<YYYYMMDD-SLUG>.md
```
This moves the file to plan/history/YYMM/learning/ and deletes the
source. Stage plan/history/ and commit.
- For each resolved GitHub Concern issue: invoke the
archive-history
skill once per entry:
TYPE = learning
TITLE = <short concern title>
SOURCE = CONCERN-<ISSUE_NUMBER>
BODY = <full original concern body>
+ "**Resolved**: YYYY-MM-DD — captured in <destination file(s)>."
+ "Docs PR: <PR_URL>."
For resolved GitHub Concern issues, post the resolution comment and close
the issue (see Phase 7 step 3 for the comment template).
Constraints
- Do not modify code or tests.
- Do not process GitHub Idea-type issues — use
plan-issuefor those. - Do not skip the grill-me phase — it must complete before any writing.
- Do not reference
plan/incoming/learnings/from durable docs. - Archive processed incoming learning files via
uv run append-history --from-file <path>; do not leave files in
plan/incoming/learnings/ after promoting.
- Archive Concern issues via the
archive-historyskill. - Verify assumptions against the codebase; do not assert absence without
evidence.