Configures Claude Code hooks and Codex hooks.json/notify. Use when adding PreToolUse guards, Stop hooks, managed hooks, format-on-save, preflight, audits, or worktree/budget hooks.
日本語の概要は準備中です。原文の説明を表示しています。
Adds per-skill learnings loops for dated patterns, mistakes, and domain facts. Use when wiring skill memory, consolidation, or drift audits.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Use this skill to wire a learnings loop into another skill so it gets better with use, without rewriting SKILL.md automatically.
The loop has four moving parts:
learnings.md — raw, append-only, committed. Shared working memory across machines; created on first append via append_learning.py, not seeded empty.learnings.consolidated.md — pruned, dated, committed. Portfolio-grade institutional memory; seeded at wiring time.learnings.local.md — machine-specific notes, gitignored. Use for one-operator-on-one-machine context that should not propagate.scripts/append_learning.py + scripts/consolidate.py — keep raw entries well-shaped and redacted, and surface recurring ones for human-reviewed consolidation.Pattern provenance and the distinction between this reviewed loop and automatic skill rewriting are in references/evidence-base.md; load it before attributing the design to an external source.
| Task | Read or Run | Outcome |
|---|---|---|
| Wire a skill to use the loop | references/wiring-protocol.md | Adds a 4-line addendum to that skill's SKILL.md, seeds files |
| Format a new learning entry | references/learnings-format.md | Atomic, dated, 5-section schema that survives pruning |
| Promote raw → consolidated | python3 scripts/consolidate.py <skill-dir> | Dry run by default: proposes dedup, age-out and recurring patterns for human review; --apply only prints the edits to make, because promotion stays a human gate |
| Append a learning safely | python3 scripts/append_learning.py <skill-dir> --section <name> --text "..." | Validates shape, dates, refuses to grow past the 150-entry cap |
| Find routing lessons that need review | python3 scripts/consolidate.py --queue [--days 14] | Exit 1 for aged open lessons, failed results, or fixes awaiting verification; invalid dates exit 2 |
| Audit drift across skills | references/audit-checklist.md | Find stale loops, missing consolidations, oversized files |
| Capture a cross-cutting behavior with no obvious skill home | references/instinct-pattern.md | Atomic, confidence-scored complement to the per-skill loop above |
references/wiring-protocol.md to seed learnings.consolidated.md, add the addendum, and verify .gitignore coverage.scripts/append_learning.py for raw entries; do not hand-edit raw learnings.md during normal operation.scripts/consolidate.py <skill-dir> when the raw file hits the cap, before release, or during a scheduled maintenance pass.references/ only as a reviewed skill edit (see Promotion Out); never auto-rewrite SKILL.md.Lesson-Ref: <date> <STALL|MISROUTE> <subject> in its final trailer block. Add → fix <sha9> → result pending to the log line. Replace pending with WIN <date> or verifier passed|failed once known; failed and pending results stay open. If a lesson needs a user decision, append {deferred: user-decision YYYY-MM-DD}. Before closure, read the receipt contract and run python3 audit/skill-status.py lessons --ref HEAD. It verifies source and gate digests; an empty receipt set cannot pass.learnings.md append-only: add a new dated corroboration or conflict through append_learning.py and reference the earlier entry or claim. Merge or deduplicate only in the derived learnings.consolidated.md during the documented human-reviewed consolidation path, preserving dates and provenance; retain unresolved conflicts as open questions until the scope or runtime difference is resolved.AGENTS.md or coding-behavior.md, not a per-skill loopreferences/ of the right skill or to agents-memory, not into every learnings filePer-skill, the loop lives inside the skill's own directory:
<skill>/
├── SKILL.md # adds the 4-line Learnings Loop addendum
├── learnings.md # committed, append-only, raw (shared across machines)
├── learnings.consolidated.md # committed, pruned, dated
├── learnings.local.md # gitignored, machine-specific, optional
└── references/... # durable rules move here by reviewed edit
Required entry shape (enforced by append_learning.py):
- [YYYY-MM-DD] <one-sentence atomic insight>Hard limits (refuse rather than truncate):
Raw learnings.md cap: 150 entries — reaching it blocks further appends. Consolidation does not reduce this append-only count; any capacity change needs an explicit reviewed edit.
Consolidated file cap: 60 entries — exceeding means the skill itself needs a references/ extraction.
Treat third-party learnings-loop examples as pattern evidence only; review provenance before installing or recommending automation. Graded source provenance for the maturity and design claims is in references/evidence-base.md.
Do not store secrets, PII, customer-specific facts, or unreleased client details in either raw or consolidated learnings files.
Rule: rules/repo/learnings.md loads this invariant when Claude edits a learnings file in this library.
Any skill that opts in adds this block, or a scoped equivalent preserving conditional reads and capture boundaries, near the end of its SKILL.md:
## Learnings Loop
When prior decisions or pitfalls are relevant, consult `learnings.consolidated.md` if present; use `learnings.md` only for needed history or as the available fallback. Otherwise skip both.
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to `learnings.md` via `agents-skills-feedback-loop/scripts/append_learning.py`. Do not modify `SKILL.md` itself.
That's it — no other change to the host skill.
references/consolidation-protocol.md. Human approves promotions to learnings.consolidated.md.Run these checks on any skill with an active loop:
python3 scripts/consolidate.py <skill-dir> --audit — confirm valid dates/sections and raw ≤150 and consolidated ≤60- [YYYY-MM-DD] (no undated bullets)SKILL.md still carries the ## Learnings Loop addendumlearnings.md and learnings.consolidated.md are committed, and learnings.local.md is the only gitignored learnings filefor loop from references/audit-checklist.md)# Audit a single wired skill (checks caps, dates, section names)
python3 skills/universal/agents-skills-feedback-loop/scripts/consolidate.py \
skills/<group>/<skill-name> --audit
# Audit all wired skills at once
for skill in skills/universal/*/ skills/project/*/ skills/client/*/*/; do
if [ -f "$skill/learnings.consolidated.md" ]; then
python3 skills/universal/agents-skills-feedback-loop/scripts/consolidate.py \
"$skill" --audit
fi
done
# Dry-run consolidation (proposes diffs, does not write)
python3 skills/universal/agents-skills-feedback-loop/scripts/consolidate.py \
skills/<group>/<skill-name> --dry-run
The base loop above is open: without a session-end hook, every append depends on an agent or human calling append_learning.py, so capture is uneven — some raw files fill while others stay empty.
The default Layer 1 hook is candidate-only. In this library it is hooks/capture-learning-candidate.py, installed by python3 scripts/setup/agent-config.py install --apply (Claude SessionEnd, Codex Stop). It appends {ts, session_id, runtime, skills_used, transcript_path} to ~/.agents/hooks/learning-candidates.jsonl: no transcript text and no model call. A human reviews each candidate and writes the lesson with append_learning.py.
The opt-in reflection hook below goes further: it detects which wired
skills a session used, runs one cheap reflection pass, and appends via the
existing append_learning.py — no new format, no SKILL.md rewrite.
It is machine-global and portable (any laptop, any username). The hook
hands the work to a detached worker and exits at once, because session-end
hooks run under a short, runtime-capped time budget. The reflection call runs
with all tools disabled and without persisting a session, since it reads
untrusted transcript text. Every entry passes through append_learning.py's
redaction step.
# From this skill directory, on any laptop:
python3 scripts/install_capture_hook.py --dry-run # preview
python3 scripts/install_capture_hook.py # apply
The installer resolves every path from $HOME at run time (nothing is
hardcoded), registers Claude Code (SessionEnd), registers Codex (Stop)
only with --codex, and is idempotent. Before adding a per-hook timeout or
wiring another runtime, look up that runtime's hooks reference for the
session-end budget, its cap, and the transcript format; a timeout above the cap
is silently clamped, and a transcript the parser cannot read captures nothing.
Full design, guardrails (recursion guard, blast-radius limit,
fail-silent-fail-logged), and verification:
references/closed-loop-capture.md.
Consolidation stays manual.
Encode a lesson at the strongest layer that fits: make the bad state unrepresentable, then a lint or validator, then a shared helper, then a runtime check, and only then prose. A consolidated entry that can become a check or a guard should leave the loop as one, not as a references/ sentence.
Moving a consolidated principle into the host skill's references/ is a normal
skill edit: a human makes it, in a reviewed commit, and deletes the entry from
learnings.consolidated.md in the same change. Where an authorized harness
exists for the target runtime, run a regression eval that passes with the rule
and fails if it is reverted; a case that passes either way proves nothing.
Otherwise record the promotion's evidence level as static or routed and make no
task-quality claim. The loop has no automated gate for this step.
The loop above works at skill granularity — one learnings.md per skill. It has a gap: behavioral observations that don't belong to any one skill (e.g. "always grep before editing a file this large," "this repo prefers functional style") have no natural skill home and go uncaptured. references/instinct-pattern.md documents a smaller-granularity complement — a single-trigger, single-action, confidence-scored (0.3–0.9), domain-tagged, project-or-global-scoped unit — adapted from affaan-m/ECC (commit 51a6950, MIT). It does not replace the loop above, does not adopt ECC's automatic project→global promotion (this repo keeps promotion human-reviewed, per ## Anti-Patterns and Rule 7 of coding-behavior.md), and is documented as a scaffold and capture-mechanism only — no seeded example entries. For hook mechanics, see agents-hooks.
The filter is project-specific. The default filter lives in references/learnings-format.md under Quality Filters. Override per-skill if your domain needs a sharper bar — e.g. a tax skill should reject anything not anchored to a tax-authority manual reference or a dated statute.
The mechanics above (caps, dates, dedup ratio) are checkable by script. The following are not, and are where most wired loops actually fail:
--audit establishes file shape, not learning quality or usage. During a feedback-loop audit, compare recurring failures with recorded lessons before diagnosing missed capture. Use raw=0, a stale oldest date, or extended silence (for example, 60 days) as prompts to inspect authorized usage evidence such as recent transcripts or the Layer 1 log. These are diagnostic cues, not failure thresholds: an empty or unchanged file alone does not justify mandatory pre-reads or prove that the loop failed.consolidate.py's duplicate clustering is syntactic, not semantic. It clusters near-identical wording (SequenceMatcher ratio ≥0.82); it will not notice that "webhook needs HMAC in header" and "signature must be in the request header, not the payload" are the same lesson said twice. Treat the script's promotion proposals as a first pass, not the ground truth for "recurred ≥2×" — a human still has to read the raw file once per cycle to catch semantically-duplicate entries the ratio threshold misses, and to catch the reverse: two genuinely different lessons that happen to share vocabulary and get wrongly clustered.SKILL.md — reject it. ACE describes loss of domain detail through compression and iterative rewriting; it does not establish that a noisy append-only file has the same failure mechanism (see references/evidence-base.md).## Consolidation Cadence) before tightening the filter.consolidation-protocol.md step 5. Distinguish "genuinely no principle was load-bearing enough" from "the human-gate step is a dead letter" by checking whether learnings.consolidated.md itself is stuck at the same size cycle over cycle.SKILL.md. If consolidation produces a durable rule, promote it to references/ by hand. Silent self-modification of skills is the failure mode this design exists to prevent.software-payments; project skills stay independent of the shared library.AGENTS.md or coding-behavior.md. General coding rules belong in those files, not in a per-skill loop.append_learning.py redacts API keys, bearer tokens, emails, and home-directory usernames before writing; do not bypass it by hand-editing raw files.project-*, software-*, marketing-*, etc.).SessionEnd; Codex Stop only with --codex)$HOME/.agents/hooks/)agents-skills — for creating or auditing the host skill itself.agents-memory — for cross-skill, cross-session memory (the 4-type schema this loop scopes from).agents-hooks — the session-end-hook mechanism behind Layer 1 auto-capture (see references/closed-loop-capture.md).まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Configures Claude Code hooks and Codex hooks.json/notify. Use when adding PreToolUse guards, Stop hooks, managed hooks, format-on-save, preflight, audits, or worktree/budget hooks.
日本語の概要は準備中です。原文の説明を表示しています。
Configures and hardens Claude Code and Codex MCP servers. Use when connecting databases, APIs, SaaS, building servers, or serving a clearance-filtered knowledge base.
日本語の概要は準備中です。原文の説明を表示しています。
Owns instruction files: AGENTS.md, CLAUDE.md, personal and repo rules. Use when writing, pruning, auditing them, sharing rules across Claude and Codex, or fixing ignored rules.
日本語の概要は準備中です。原文の説明を表示しています。
Creates and audits agent skills: SKILL.md, references, scripts, runtime metadata. Use when writing, validating, or security-reviewing a skill, or fixing truncated skill listings.
日本語の概要は準備中です。原文の説明を表示しています。
Chooses subagent, team, workflow, or debate and launches it on Claude Code or Codex. Use when delegating, running agent review boards, or installing shared agents.
日本語の概要は準備中です。原文の説明を表示しています。
Designs and runs agent hives and multi-agent waves. Use when setting hive roles, code gates, dependency-graph fan-out, or verifier, vote and loop-until-dry passes.
日本語の概要は準備中です。原文の説明を表示しています。