C31-compound

C31-compound is a skill for Claude Code, Codex from ChianW/C31. It costs 36 tokens per session (3,256 once invoked), scanned A, original, MIT.

A way to record a verified solution after a difficult problem has been fixed. It decides whether the lesson belongs in documentation, an automated check, a script, a test, or a reusable skill.

In plain words
What is it for?
Use it after solving a non-trivial bug or technical issue to document the root cause, preserve the working solution, and improve future checks or agent behavior.
Why use it?
Without recording the cause and solution, the same problem may require fresh investigation later. Putting repeatable lessons into structure can make them easier to apply consistently.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents; mentions AGENTS.md.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/chianw/c31/c31-compound
Any agent
npx skills add ChianW/C31 --skill c31-compound
Clone the repo
git clone --depth 1 https://github.com/ChianW/C31

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for C31-compound

README.md
[![agentmods](https://agentmods.dev/badge/skills/chianw/c31/c31-compound.svg)](https://agentmods.dev/skills/chianw/c31/c31-compound)
Your own site
<a href="https://agentmods.dev/skills/chianw/c31/c31-compound"><img src="https://agentmods.dev/badge/skills/chianw/c31/c31-compound.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,256 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.03256
Opus 5 $0.00018 $0.01628
Sonnet 5 $0.00007 $0.00651
Haiku 4.5 $0.00004 $0.00326

Measured 5d ago against content hash 185082fa6b2f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

C31-compound scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/core/C31-compound/SKILL.md · 307 lines

How it starts

The opening of the file, as written. The whole thing — 307 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Multilingual Triggers

Language Trigger phrases
EN solved, fixed, working now, root cause, that worked, compound, document this, 解决了, 搞定了, 原来是因为, C一下
ZH 复利, 记录知识, 总结
JA 知識を記録する, コンパウンド, まとめる

Output language: Respond automatically in the user's conversation language.

C31-compound — Knowledge Compounding

Capture a recently solved problem as structured documentation so future occurrences take minutes instead of research cycles.

Preconditions

  • Problem has been solved (not in-progress)
  • Solution has been verified working
  • Non-trivial problem (compound_score ≥ 15, or user insists)

Structural Routing (pstack/reflect, merged 2026-08-19)

Before writing the solution doc, route the learning:

  1. Structural enforcement check: if this lesson is enforced more reliably by a lint rule, script, metadata flag, runtime check, or test than by a doc, propose the structural artifact instead (doc becomes secondary). Lessons living only in text re-decay; lessons in structure fire themselves.
  2. Skill-edit branch: if the learning generalizes to future agent behavior (a skill's wording caused the dead end, or a missing rule would have prevented it), the primary artifact is a skill edit proposal — present it to the user and apply only after explicit approval. Skill changes affect every future session; never auto-apply.
  3. One-off filter: skip when the episode is trivial, off-topic, or already covered by an existing skill the agent simply failed to follow. One-offs are not learnings; recording them dilutes the library.

Auto-Draft Mode (Default)

When triggered by auto-invoke phrases (not manual command), enter lightweight draft mode first.

Behavior:

  1. Skip blocking questions
  2. Extract from recent conversation context:
    • Problem: 1-2 sentence description
    • Symptoms: Observable symptoms
    • What Didn't Work: Failed attempts
    • Solution: Actual fix
  3. Duplicate detection:
    • Use memory_search to query key words from the Problem description + core tool/filename from Solution
    • If a similar solution with score > 0.7 is found:
      • Emit a brief note: ⚠️ Similar record detected: {filename} (date)
      • Append options: [Overwrite] update existing file / [Append] add new case study / [Skip] do not save
      • If user says "Overwrite" → update existing file (append last_updated: YYYY-MM-DD, add new observations at end)
      • If user says "Append" → append a new case study block at end of existing file
      • If user says "Skip" or no response (30s) → discard current draft, do not save
      • Interrupt current Auto-Draft flow; next steps are user-driven
    • If no match or score ≤ 0.7 → continue to step 4
  4. Auto-calculate compound_score = Severity × Frequency × Uniqueness × Scope
    • Severity: 1-5 (how bad was the problem)
    • Frequency: 1-5 (how likely to recur)
    • Uniqueness: 1-5 (how non-obvious was the solution)
    • Scope: 1-5 (impact range: single file → cross-skill → systemic)
      • 1 = within a single file / single skill
      • 2-3 = across files or across skills
      • 4-5 = systemic / framework-level / affects multiple workflows
  5. Tiered auto-save:
    • compound_score ≥ 50 → trigger Full Mode async execution
      • Spawn background subagent to run Phases 0.5–4 (parallel research + full assembly)
      • Main conversation only emits: ✍️ High-value problem detected ({score} pts) — generating full compound doc in background...
      • Completes silently; no further interruption
    • 15 ≤ compound_score < 50 → auto-save lightweight version to memory/solutions/, silently
      • Emit brief note: ✍️ Auto-recorded — {filename} (compound_score: {score})
    • compound_score < 15 → skip silently. No notification.

Read the full file on GitHub · 307 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 307 lines · 36 tokens per session scan A 185082fa6b2f

Subscribe to this mod's changes

C31-compound is a skill published in the GitHub repository ChianW/C31 (1 stars, last pushed 10d ago), licensed MIT. It adds 36 tokens to every session and 3,256 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.