En learn
Compounding wiki maintainer for docs/learnings/. Six modes: capture (default; file a learning post-build/qa, sync architecture/foundation/plan, move plan to completed); ingest <path-or-url>; --refresh (audit staleness); --pack <library>; --lint (graph health — orphans, broken links, contradictions); --bootstrap-patterns (one-time retrofit, seeds patterns/ from existing codebase). Always-on cross-reference maintenance. Trigger phrases: 'capture this', 'learn from', 'ingest', 'pack docs', 'audit learnings', 'wiki health'.From its SKILL.md
npx -y skills add manok4/ensemble --skill en-learnAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
15.8 KB, as published. Nobody here has run it
Helper resolution. All
references/Xandbin/Ypaths in this skill resolve relative to$ENSEMBLE_ROOT— the install root (skill at$ENSEMBLE_ROOT/skills/<name>/, shared helpers at$ENSEMBLE_ROOT/{references,bin}/). Compute once at start:$ENSEMBLE_ROOTenv var if set; otherwise$(realpath "$(dirname <this-SKILL.md>)/../.."). Fail loudly if$ENSEMBLE_ROOT/references/host-detect.mddoes not resolve — that indicates a partial install (run/en-setupto repair).
/en-learn
Maintain docs/learnings/ as a compounding interlinked wiki — not a flat folder. Adopts Karpathy's LLM Wiki pattern: agent-maintained, with index.md + log.md for navigation and --lint for graph health.
Modes
| Mode | Trigger | Output |
|---|---|---|
capture (default) | After feature ships, bug fixed, or synthesis emerges | docs/learnings/<category>/<slug>-<date>.md + side effects |
ingest <path-or-url> | Reading external engineering material | docs/learnings/sources/<slug>-<date>.md + 5-15 page back-refs |
--refresh | Audit content staleness (~monthly) | Per-entry: keep / update / replace / archive |
--pack <library> | Curate external library reference | docs/references/<library>-llms.txt |
--lint | Wiki-graph health check | JSON report of orphans, missing back-refs, etc.; --fix auto-applies |
--bootstrap-patterns | Retrofit existing project (one-time during/after /en-foundation --retrofit) | 5-10 entries in docs/learnings/patterns/ flagged source: bootstrap, confidence: 6, requires_validation: true |
Always-on behaviors (across capture and ingest)
After every write:
- Active cross-reference maintenance — walk new entry's
related: []; add reciprocal back-refs to each cited page. Per$ENSEMBLE_ROOT/references/learn-cross-ref-maintenance.md. - Index update — append a one-line entry to
docs/learnings/index.mdunder the appropriate category. Per$ENSEMBLE_ROOT/references/learn-index-format.md. - Log append — single line to
docs/learnings/log.md:## [YYYY-MM-DD] <op> | <subject>for most ops;capturemode appends| <head-sha>fromgit rev-parse --short HEADas the baseline marker for/en-ship's learning checkpoint. Per$ENSEMBLE_ROOT/references/learn-log-format.md. Other ops (refresh,ingest-url,lint-fix,pack,capture-from-conversation) don't write SHA — onlycaptureresets the baseline.
Process — Mode A: capture (default)
- Detect host (light). Source
$ENSEMBLE_ROOT/references/host-detect.md. - Recursion guard. If
ENSEMBLE_PEER_REVIEW=true, skip (no peer review on capture). - Detect input source.
- Default (post-build / post-qa) — read recent commits + branch summary.
--from-conversation— take user-confirmed synthesis as input (fired by D21 capture-from-synthesis).- Explicit subject — user describes what to capture.
- Identify category.
bugs/(bug fixes),patterns/(reusable approach),decisions/(architectural/technical choice with rationale). - Spawn parallel sub-tasks.
- Context Analyzer — extract problem, symptoms, root cause from conversation + commits.
- Solution Extractor — capture the fix, why it works, prevention strategy.
- Related Docs Finder — search
docs/learnings/for overlap; flag near-duplicates; identify pages that should back-link.
- Compose entry. Body shape from
$ENSEMBLE_ROOT/references/templates/learning-template.md(TL;DR / Context / What didn't work / Root cause / Fix / Why it works / Prevention / Related / Citations). - Slug + path. Generate
<slug>-<date>(lowercase, alphanumeric + hyphens, ≤60 chars +-YYYY-MM-DD). Write todocs/learnings/<category>/<slug>-<date>.md. - Apply always-on behaviors (cross-refs, index update, log append).
- Sync
docs/architecture.mdif material structural change (new module, changed boundaries, new infrastructure, dependency direction shifts, new external integration). Surgical edits only — never regenerate. Bumpupdated:. Per$ENSEMBLE_ROOT/references/architecture-update-rules.md. - Sync
foundation.mdif scope, decisions, or top-level direction changed. - Plan-lifecycle handling. Step 11 splits into two sub-steps that separate lifecycle bookkeeping (always runs) from documentation-tense rewrites (only runs on actual capture). Rationale: previously this step was bundled — if the user opened
/en-learnand said "skip — no learnings to capture," the lifecycle flip was collateral damage and the plan got orphaned atstatus: in_progress. The unbundle ensures the lifecycle flip happens whenever/en-learn captureis invoked, regardless of whether a learning was actually filed. The en-ship plan-completion checkpoint (perdocs/en-ship-plan-completion-checkpoint-spec.md) is the backstop for cases where/en-learnisn't invoked at all.
11a. Lifecycle flip (always runs when a plan_id is in context). If /en-learn capture was invoked within the context of a specific plan (derivable from the current branch name per <plan_id>-<slug> convention, or passed via --plan <plan-path>), perform the lifecycle flip:
- Read frontmatter; check
status:. - If
status: in_progressORstatus: open: flip tostatus: completed, setshipped: <today>. Bothopenandin_progressflow into this path — theopencase preserves the recovery for builds that skipped theopen → in_progressflip (interrupted build, manual resume, etc.). - If
status: completed: no-op; plan already moved. - If
status: draftORstatus: abandoned: skip the flip; surface a one-line notice (/en-learnshouldn't be flipping a draft plan to completed). git mv docs/plans/active/<PREFIX><NN>-<plan_type>_<slug>.md docs/plans/completed/<PREFIX><NN>-<plan_type>_<slug>.md(filename preserved verbatim during the move).- Stage the rename + frontmatter edit.
11a always runs, even when the user picked "skip — no learnings worth filing" earlier in the capture flow. The flip is lifecycle bookkeeping; it shouldn't be tied to whether wiki content was filed.
11b. Documentation-tense updates (only runs when a learning was actually captured). If a learning was captured during this /en-learn capture invocation (i.e. step 6's compose-entry produced a real file in docs/learnings/<category>/), AND 11a ran (plan was moved), also:
- Replace plan-tense ("we will", "this should") with documentation-tense ("we did", "this does").
- Note any deviations from the plan (sections of the plan that didn't ship as written, or that landed differently).
11b is skipped when the user said "skip — no learnings worth capturing" earlier in the flow; lifecycle flip (11a) still happens, just without the documentation-tense rewrite.
Edge case: no plan_id in context. If /en-learn capture is invoked outside any plan context (no plan branch, no --plan argument), step 11 is a silent no-op — there's nothing to flip.
12. Sync AGENTS.md / CLAUDE.md only if the artifact directory or top-level guidance changed (rare).
13. Update docs/README.md index if it exists.
14. Regenerate docs/generated/learning-index.md by appending the new entry; bump total_entries.
Process — Mode B: ingest <path-or-url>
Per $ENSEMBLE_ROOT/references/learn-ingest.md:
- Read source. File:
Read. URL:WebFetchwith Wayback fallback (per A13). - Off-topic check. LLM-judged relevance against
foundation.md. Threshold 0.3 / 1.0 (per A18). Below → silently skip with note ("This source appears off-topic for an engineering wiki — skipped. Re-run with--forceto ingest anyway.").--forceoverrides. - Discuss takeaways. Brief — one or two paragraphs.
- Write summary.
docs/learnings/sources/<slug>-<date>.mdwith frontmatter includingsource_type: file|url,source_uri: <path-or-url>,fetched: YYYY-MM-DD. - Walk 5–15 related pages. Use
learnings-researchagent (or grep + read). Add reciprocal back-refs. - Apply always-on behaviors.
Optional: --category {sources|patterns|decisions} (default sources).
Process — Mode C: --refresh
Audit content staleness (distinct from --lint's structural health):
- List all entries in
docs/learnings/(excludingarchive/). - For each entry:
- Read frontmatter + TL;DR.
- Determine: keep / update / replace / archive.
- User confirms each disposition (or
--autofor non-judgment cases).
- archive → move to
docs/learnings/archive/; updateindex.md(remove entry); append log line. - replace → write a new entry citing the old via
replaced_by:; mark oldstatus: superseded. - update → in-place edit; bump frontmatter
date:doesn't change (immutable); add a "Last updated YYYY-MM-DD" inline note.
Useful periodically (~monthly) or after a big architectural shift.
Process — Mode D: --pack <library>
Per $ENSEMBLE_ROOT/references/pack-reference-template.md:
- Resolve library identifier via Context7 (
mcp__context7__resolve-library-id). - Pull docs (
mcp__context7__get-library-docsorquery-docs). - Optionally augment with WebSearch for recent best-practice content.
- Flatten to
docs/references/<library>-llms.txtwith frontmatter header. - Add entry to
docs/references/index.md. - Append
log.md:## [<date>] pack | <library>. - Surface in
AGENTS.md"Where things live" if the library is project-significant.
Always re-fetches and re-flattens (per A12 — explicit invocation, fresh by default).
Process — Mode E: --lint / --lint --fix
Per $ENSEMBLE_ROOT/references/learn-lint.md. Audits the wiki graph:
- Orphans, missing back-refs, broken links, contradictions, missing pages, stale references, index drift, log drift, data gaps.
--fixauto-applies mechanical fixes (back-refs, broken-link repair, index regen, log append).- Judgment items (orphans, contradictions, missing-page candidates) → surfaced for the user.
Output: JSON-lines + markdown summary.
Process — Mode F: --bootstrap-patterns
Seeds docs/learnings/patterns/ from an existing project's codebase. One-time retrofit step — meant to give a State-2 project a starting wiki rather than waiting months for organic capture. Per $ENSEMBLE_ROOT/references/learn-bootstrap-patterns.md.
- Detect host. Source
$ENSEMBLE_ROOT/references/host-detect.md. - Recursion guard. If
ENSEMBLE_PEER_REVIEW=true, exit. - Refuse if already bootstrapped. Scan
docs/learnings/patterns/for entries with frontmattersource: bootstrap. If any exist, refuse with: "Bootstrap was already run on<date>. Use/en-learn --refreshto validate or update existing bootstrapped patterns. Force re-run with--force." - Confirm with user. Surface: "Will dispatch
repo-researchto identify 5–10 strong conventions in this codebase and file them aspatterns/entries flaggedrequires_validation: true. These are reconstructions, not captures from real moments — lower confidence by design. Continue? (y/n)" - Dispatch
repo-research. Prompt structured per$ENSEMBLE_ROOT/references/learn-bootstrap-patterns.md§ "Research prompt." Asks the agent to identify durable conventions in: file layout, naming, dependency direction, error-handling shape, test placement, common abstractions, framework idioms. Returns 5–10 candidates as JSON. - Cap at 10. If the research agent returns more than 10, take the top 10 by
confidencefield. Fewer than 5 → surface a warning; the codebase may not have strong conventions yet (typical for very young or scattered repos). - Compose entries. For each candidate, write
docs/learnings/patterns/<slug>-<date>.mdusing$ENSEMBLE_ROOT/references/templates/learning-template.mdwith:- Frontmatter:
source: bootstrap,confidence: 6,requires_validation: true,bootstrap_run: <YYYY-MM-DD>. - Body: TL;DR, Where this applies (file paths/globs), Pattern (the convention), Why (rationale inferred from codebase signals), How to follow it (concrete rules), Citations (specific file:line examples that exhibit the pattern).
- Skip the "What didn't work" / "Root cause" / "Fix" sections — those don't apply to forward-looking conventions.
- Frontmatter:
- Apply always-on behaviors. Cross-refs (none on first run), index update (one line per entry under "Patterns"), log append (one summary line:
## [<date>] bootstrap | <count> patterns from repo-research). - Surface a follow-up suggestion. "Bootstrap complete. <count> patterns filed in
docs/learnings/patterns/withrequires_validation: true. Review and validate as you encounter them in/en-review,/en-resolve-pr, or via/en-learn --refresh. Validated entries clear the flag."
Flags:
| Flag | Effect |
|---|---|
--force | Re-run even if previous bootstrap entries exist (existing bootstrap entries are kept; new ones append) |
--dry-run | Print the candidates the research agent returns without writing files |
--max-patterns <N> | Cap number of entries (default 10) |
Cross-review: off. Bootstrap entries are explicitly lower-confidence; peer review on each one would be theater.
Auto-invoke triggers (per A3 / D26)
/en-learn auto-runs after /en-build and /en-qa. Soft prompt:
"Capture learnings from this build? (yes / skip)"
User accepts → invoke capture mode. User declines → no-op.
Also fires on D21 (capture-from-synthesis) when /en-plan, /en-review, or /en-brainstorm ends with a synthesis worth filing.
Cross-review
Off by default in all modes. --peer enables Outside Voice on the entry before write (rare; usually unnecessary for learnings).
Reference files
$ENSEMBLE_ROOT/references/learn-bootstrap-patterns.md— Mode F prompt + entry shape$ENSEMBLE_ROOT/references/templates/learning-template.md— body structure for capture/ingest writes$ENSEMBLE_ROOT/references/learning-frontmatter-schema.md— frontmatter rules + examples$ENSEMBLE_ROOT/references/learn-cross-ref-maintenance.md— always-on back-ref behavior$ENSEMBLE_ROOT/references/learn-index-format.md—index.mdstructure$ENSEMBLE_ROOT/references/learn-log-format.md—log.mdstructure$ENSEMBLE_ROOT/references/learn-ingest.md— file + URL ingest flow with Wayback fallback$ENSEMBLE_ROOT/references/learn-lint.md— check catalog and auto-fix rules$ENSEMBLE_ROOT/references/architecture-update-rules.md— when to touchdocs/architecture.md$ENSEMBLE_ROOT/references/pack-reference-template.md—*-llms.txtstructure$ENSEMBLE_ROOT/references/host-detect.md
Failure protocol
| Failure | Behavior |
|---|---|
Source unreadable on ingest (404, 403, paste declined) | Log; exit non-zero; no partial write |
| Off-topic skip | Log; exit 0 with one-line note |
| Cross-ref walk partial failure | Primary write succeeds; surface partial; --lint self-heals later |
| Frontmatter schema validation fails | Log diff vs expected; user fixes manually |
docs/architecture.md sync conflict (concurrent edit) | Stop sync; surface; user resolves |
| Plan move active→completed but plan still has open units | Refuse the move; surface "FR07 has 2 incomplete units; not moving to completed/" |
--lint finds 100+ violations | Cap report at top 50; note total count; suggest running --fix |
| Slug collision (same date, same title) | Append -<short-hash> to disambiguate |