factory-learn
Use when coordinating continuous improvement loops (team-levelup + change + evals feedback + cleanup) targeting team-ai-directives — includes build-to-delete pruning and promote-to-check.
How do I install this agent skill?
npx skills add https://github.com/tikalk/adlc-team-skills --skill factory-learnIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill manages a continuous improvement loop by orchestrating several sub-skills. It uses local scripts to maintain a ledger of recurring review findings, which it populates by fetching metadata from GitHub pull requests. It implements a robust trust model, validating that findings come from authorized collaborators and correspond to existing local run records. It requires access to git history, the local file system, and the GitHub API, so it should be used in environments where the user has appropriate permissions for these resources.
- Socketpass
No alerts
- Snykfail
Risk: CRITICAL · 4 issues
What does this agent skill do?
factory-learn
What this skill does
factory-learn orchestrates the continuous improvement learning loop of the software factory. It coordinates individual learning-related skills (team-init, team-levelup, change-init, change-clarify, change-publish, team-repair, evals-analyze) to transition draft directives into verified, published, and minimal team context assets.
It operates as a Kind-A DAG orchestrator in alignment with the shared executor engine contract in factory-runbook/references/executor.md.
Requires: the factory-runbook skill (provides the shared executor contract): adlc-cli skills add tikalk/adlc-team-skills --skill factory-runbook
Consumes
evals-analyzeoutput for the feedback-loop ingestion step below; install it alongside when running retrospectives:adlc-cli skills add tikalk/adlc-team-skills --skill evals-analyze.
When to use
- You want to extract and compile hard-won session learnings into your team's centralized
team-ai-directivesrepository. - You want to turn a reviewed PR and its agent run into candidate team CDRs with evidence links.
- You want to mine git commit history to capture the rationale (ChDRs) behind past reverts and hotfixes.
- You want to run "Build to Delete" (Harness Decay checks) to prune redundant rules.
When NOT to use:
- For product-level specification or development (use
factory-intentorfactory-missioninstead). - If the team directives repository is completely unconfigured (run
/team-setupfirst).
Lifecycle DAG & Step Resolution
factory-learn implements a fixed named-skill DAG (fixed step resolution):
Session Learnings Route (default on session-end)
specify(generatephase) -> Invoketeam-levelupto extract candidate Context Directive Records (CDRs) and compliances from the active session.clarify⭐ (clarifyphase) -> Invoketeam-levelupto review pending CDRs. Enforces the evals-regression gate (running the compliance goldset as theverifysub-phase to ensure no quality degradation).publish(buildphase) -> Invoketeam-levelupto package accepted CDRs, index them, and compile a draft PR targeting theteam-ai-directivesrepository.prune(analyzephase) -> Runs the cleanup bot over the directive store to detect and propose deprecations of superseded, contradictory, or stale rules. Deprecations feed back toteam-levelup.
PR + Agent-Run Review Route (--pr <id> --run <run_id>, on-demand)
Turns one reviewed PR and the agent run that produced it into CDR candidates — the richest signal source, because it carries the review verdict (what an independent reviewer flagged) plus the run record (what the agent actually did).
collect(generatephase) -> Gather the two evidence sources; abort with a named gap (never infer) when either is missing:- PR evidence: exact-head review verdict (
factory-reviewverdict comment withhead=<sha>+outcome=), the PR diff, and Important findings. - Run evidence: the run's shared state (
.adlc/workflows/runs/<run_id>/state.jsonviaadlc-cli workflow status) and evidence files. - Correction signal: human corrections on review threads (the reviewer asked for a change and the agent applied it) — each is a CDR candidate by default; a correction the agent already applied without a rule change is the strongest candidate.
- PR evidence: exact-head review verdict (
suggest(analyzephase) -> Classify each pattern through the correction-elimination ladder BEFORE drafting anything, then write only what the classification allows:- Tier 1 structural -> route to
/architect-specifyand an ADR. No CDR draft is created. - Tier 2 mechanical -> route to action P — Promote to check, or to
/evals-specifywhen a new eval criterion is the vehicle. At most a thin pointer CDR is created. - Tier 3 judgment-only -> draft the CDR on the shared template at
skills/team/templates/cdr-draft-template.md. Scoring never overrides this classification, and a mechanically checkable mistake never defaults to a prose CDR. Every Tier-3 candidate MUST cite both sources: PR link + verdict head SHA, and run ID + step/state pointer. A candidate with no PR link or no run pointer is incomplete — send it back tocollect, do not publish it.
- Tier 1 structural -> route to
clarify⭐ (clarifyphase) -> Present the candidates one at a time under the same A/B/C/D/P choice contract asteam-levelupPhase 3 (D accepts all remaining). The human accepts, rejects, or promotes each candidate. This route never auto-approves — not even in autonomous mode — and nothing publishes without this gate.publish(buildphase) -> Accepted CDRs follow the Session Learnings routepublishstep: package, index, and compile a draft PR targeting theteam-ai-directivesrepository.
Historical Mining Route (brownfield)
init(generatephase) -> Invokechange-initto mine git history and issue trackers for Change Decision Records (ChDRs).clarify⭐ (clarifyphase) -> Invokechange-clarifyto run interactive provenance reviews on mined claims.publish(buildphase) -> Invokechange-publishto promote accepted ChDRs intodocs/adlc/memory/chdr/and regenerate indices.
Maintenance & Build-to-Delete Route (periodic)
verify(verifyphase) -> Runteam-repair --build-to-delete. Re-runs goldset evals with rules temporarily disabled. Two questions per rule:- Build-to-delete: if the model passes without the rule, the rule is flagged as redundant.
- Promote-to-check (deterministic-checks-first, EVAL-010): if a deterministic check (unit test / binary grader / pre-commit hook / lint rule / CI job) can mechanically enforce the rule, flag it as a promotion candidate — pay once for the check instead of re-injecting a fuzzy rule into every session.
clarify⭐ -> Proposes the redundant rule's deprecation and the mechanical rule's promotion toteam-levelupfor human review. Promotions route to action P — Promote to check (team-levelup Phase 2b); once the check exists and runs in CI, the CDR is deprecated or reduced to a thin pointer. Both proposals publish asfindings.
Workflow Retrospective Route
Runs periodically or on-demand to analyze past runs of other factory skills (e.g. factory-mission, factory-intent) and generate workflow memories:
analyze(analyzephase) -> Scan completed/failed runs' shared state (.adlc/workflows/runs/<run_id>/state.jsonviaadlc-cli workflow status) and evidence files. Identify patterns, recurring errors, or successful corrections.- Also sweep
.adlc/drafts/{adr,pdr,chdr,cdr,evals}/for unclarified entries (frontmatter/heading status proposed/discovered/draft); surface each as a finding (Draft ID + type + age), independent of whether session_end/file_edited hooks ever fired. - Git correction signals (reuse
change-initPhase 6 semantics verbatim — do not duplicate or reinterpret):git log --grep='^Revert "'andgit log --grep='revert' -ifor reverts; commits whose subject matchesfix(?!ed)?\borhotfixtouching the same files as an earlier commit for fix chains. Record pairs as negative knowledge attached to the finding. - Repeated REVIEW.md findings across PRs: recurrence identity is same pass + same check item (the Twice-Mistake identity in
factory-review/references/review-policy.md), sourced from run scratchpads (runs/<run_id>/scratchpads/review-findings.txt) and verdict markers. The recurrence evidence lives inadlc-team-skillswhere the findings originate; a proposed CDR or check's destination repo does not move the evidence. Validated observations append toreferences/recurrence-ledger.tsv(schema inreferences/recurrence-ledger.md) viascripts/bash/verify-recurrence.sh run(orscripts/powershell/verify-recurrence.ps1 run) only: live-head-at-verification rows (verified-how=live-head,standing=live-head-at-verification), append-only, observation-identity idempotence (recurrence rerun-idempotency decision: same recurrence key + same provenance —verified-atexcluded as confirmation metadata — reruns report DUPLICATE with ledger bytes unchanged; any other provenance difference aborts on conflict), abort on provenance conflict. Only one ledger-writer PR may be open at a time (ledger-writer-active+ blocking PR number, exit 2); rebase onto latestorigin/main, union both row sets, deduplicate, re-validate, re-green CI. The ledger is historical evidence, not merge standing —check-verdict-head.shremains the live merge-gate authority.memory.jsonlcontract unchanged. - Event-stream seed signals (admissibility + thresholds in
references/eval-seed-taxonomy.md— the four highest-frequency signals are named inputs to the retrospective): converge CONTINUE / score-regression / circuit-breaker events fromstate.jsonacross runs; gate rejects with revise routing from gate payloads; human edits between gate approval and merge (gatehead=<sha>vs merged diff); reopens after merge (factory-tickets). Every signal follows the same seed contract as REVIEW.md findings: 2 reproduced occurrences in ≥2 distinct runs before any criterion is authored; prose comments are admissible only when the failure was reproduced.
- Also sweep
clarify⭐ -> Present proposed memories (active vs tentative) to the user (in gated/hybrid modes) or auto-approve (in autonomous mode). Route each recurring correction through the ordered elimination ladder (Tier 1 structural →/architect-specify/ADR; Tier 2 mechanical → team-levelup action P or/evals-specify; Tier 3 judgment → prose CDR). Classify before scoring. A mechanically checkable mistake must never default to a prose CDR. Tier-2 split (check vs eval, decided by decidability), seed admissibility (event stream, reproduction rule), authoring threshold (2 reproduced occurrences in ≥2 distinct runs), and temporal holdout followreferences/eval-seed-taxonomy.md.publish(buildphase) -> Write approved memories to.adlc/workflows/memory.jsonl(workspace-global). Memories carry weights and use counts; stale or counter-productive memories are automatically archived. Thememory.jsonlcontract (weights, use counts, auto-archive) is unchanged — ladder routing decisions are recorded in the finding, not as schema changes.
Shared Executor Overrides
factory-learn overrides the shared executor engine primitives as follows:
- Publish Target: Fixed to
external-repo. Opens or updates a draft pull request on the configuredteam-ai-directivesrepository. Since the publish target is a PR on the directives repo, the comment bus operates on that PR — step outputs (decisions, findings) are published as marker comments on the directives PR. - Output Types: Steps use the following
output_typeassignments:specify/init→draft(CDR/ChDR drafts stay in.adlc/drafts/, not published to comment bus)clarify⭐ →decision(accepted/rejected CDR/ChDR list published to comment bus on the directives PR)publish→artifact-ref(PR URL reference published, content stays on disk)prune/verify→findings(redundancy/deprecation report published to comment bus)
- Feedback Loop Ingestion: Automatically consumes the output of
evals-analyze(when an application test fails due to specification issues,evals-analyzeautomatically routes toteam-levelup, which triggers this orchestrator). - Supervision Default:
hybrid. Human gates are hard-enforced atclarify⭐ (approval of CDR/ChDR entries) and at final PR creation. - Pre-flight Check: Verifies that
team-levelup,change-*, andteam-*skills are installed, and that the directives repo path is set in.adlc/init-options.json.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/tikalk/adlc-team-skills/factory-learn">View factory-learn on skillZs</a>