agentleFS
ChianWChianW/C31/skills/core/C31-compound/SKILL.md

C31-compound

Skill1 starsChanged 3 months agoMITView on GitHub

solved, fixed, compound, 解决了 | 知识固化:将已解决的问题记录为结构化文档供未来复用

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 12 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before writing the solution doc, route the learning:

    line 31
  2. Distinctive:

    Structural enforcement check: if this lesson is enforced more reliably by a lint rule, script, metadata flag, runtime check, or test than …

    line 33
  3. Distinctive:

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

    line 39
  4. Very specific:

    Use memory_search to query key words from the Problem description + core tool/filename from Solution

    line 50
  5. Distinctive:

    If a similar solution with score > 0.7 is found:

    line 51
  6. Distinctive:

    If no match or score ≤ 0.7 → continue to step 4

    line 58
  7. Distinctive:

    When user chooses "Full" or invoked with "compound this" / "document this":

    line 86
  8. Very specific:

    Run memory_search with query matching the problem topic.

    line 90
  9. Distinctive:

    After recording the preliminary track determination, launch the following subagents:

    line 102
  10. Very specific:

    Run memory_search with tight query (default: 7 days).

    line 137
  11. Very specific:

    Check whether AGENTS.md / MEMORY.md references memory/solutions/:

    line 158
  12. Distinctive:

    Read existing instruction files

    line 159
  13. Distinctive:

    When to search it

    line 163
  14. Distinctive:

    If not met → draft smallest addition to communicate these three things

    line 164
  15. Distinctive:

    Must see "solved" / "verified" or equivalent confirmation before entering draft flow

    line 257
  16. Distinctive:

    If a bug is found in the skill itself → go through the normal fix process.

    line 265

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Multilingual Triggers

LanguageTrigger phrases
ENsolved, 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.

    No checkpoint. No user selection. The skill runs and completes without interruption.

If user explicitly says "compound this" / "document this" / "保存" / "记录": → Proceed directly to Full Mode (Phase 0.5 onwards), bypassing Auto-Draft tiering.

If user explicitly says "skip" / "不要记" / "不用记录": → Discard silently, no save, no notification.

Full Mode (Manual or Selected)

When user chooses "Full" or invoked with "compound this" / "document this":

Phase 0.5: Auto Memory Scan

Run memory_search with query matching the problem topic. If relevant entries found, prepare labeled excerpt block for Phase 1 subagents.

Phase 1: Parallel Research

Critical: subagents return TEXT DATA only. Orchestrator writes files.

🛑 STOP: Based on the problem description, make a preliminary determination of track type:

  • Unexpected failure / error / abnormal behavior → bug
  • Working pattern / best practice / design decision → knowledge
  • Cannot determine → mark as unknown; let the Context Analyzer subagent make the final call

After recording the preliminary track determination, launch the following subagents:

Launch these subagents in parallel:

1. Context Analyzer

  • Determines track: bug (unexpected failure) or knowledge (pattern/guidance)
  • Identifies: problem_type, component, category
  • Suggests filename: YYYY-MM-DD-[sanitized-slug].md
  • Returns: YAML frontmatter skeleton, category, track

2. Solution Extractor

  • Adapts output structure based on track:

Bug track sections:

  • Problem: 1-2 sentence description
  • Symptoms: Observable symptoms
  • What Didn't Work: Failed attempts and why
  • Solution: Actual fix with examples (before/after)
  • Why This Works: Root cause explanation
  • Prevention: Concrete strategies, test cases, lint rules

Knowledge track sections:

  • Context: Situation that prompted guidance
  • Guidance: Practice/pattern with examples
  • Why This Matters: Rationale and impact
  • When to Apply: Conditions where this applies
  • Examples: Concrete before/after or usage

3. Related Docs Finder

  • Searches memory/solutions/ for related documentation
  • Uses grep/ripgrep for pre-filtering on title:, tags:, problem_type:
  • Assesses overlap: High (same problem, update existing) / Moderate (related) / Low (distinct)
  • Returns: links, relationships, refresh candidates

4. Session History (optional)

Run memory_search with tight query (default: 7 days). Structure findings as:

  • What was tried before
  • What didn't work
  • Key decisions

Phase 2: Assembly & Write

WAIT for all Phase 1 subagents to complete.

  1. Collect all Phase 1 text results
  2. Check overlap assessment:
    OverlapAction
    HighUpdate existing doc. Add last_updated: YYYY-MM-DD.
    Moderate/Low/NoneCreate new doc.
  3. Assemble complete markdown
  4. Validate YAML frontmatter
  5. Write to memory/solutions/YYYY-MM-DD-[slug].md

Phase 3: Discoverability Check

Check whether AGENTS.md / MEMORY.md references memory/solutions/:

  1. Read existing instruction files
  2. Assess whether an agent would learn:
    • That a searchable knowledge store exists
    • Its structure (YAML frontmatter, category organization)
    • When to search it
  3. If not met → draft smallest addition to communicate these three things

Interactive mode: Show proposed change, ask consent before editing. Headless mode: Apply edit silently, surface in report.

Phase 4: Project Integration (if .planning/ exists)

If memory/.planning/ exists:

  • Append a summary entry to .planning/debug/knowledge-base.md
  • Format: - YYYY-MM-DD: [title] (compound_score: X, file: solutions/...)
  • This links compound knowledge to active project tracking

YAML Frontmatter Template

---
compound_score: [1-125]
date: YYYY-MM-DD
category: [tooling | workflow | database | api | frontend | backend | security | performance | unknown]
problem_type: [brief-classification]
track: [bug | knowledge]
tags: [tag1, tag2]
status: [active | resolved | deprecated]
---

Success Output

✓ Documentation complete

File: memory/solutions/YYYY-MM-DD-[slug].md  (created | updated)
Track: <bug | knowledge>
Category: <category>
compound_score: <score>
Overlap: <none | low | moderate | high — existing doc updated>
Knowledge-base: <not updated | appended to .planning/debug/knowledge-base.md>

The Compounding Philosophy

Build → Test → Find Issue → Research → Improve → Document → Validate → Deploy
    ↑                                                                      ↓
    └──────────────────────────────────────────────────────────────────────┘

Each unit of work should make subsequent units easier — not harder.

Error Handling

This skill follows the AGENTS/error-handling.md standard.

Common Error Codes

Error CodeTrigger ScenarioHandling Strategy
API_TIMEOUTmemory_search / file operation timeoutWait 4s and retry, max 2 times
RATE_LIMITEDAPI rate limiting (search, subagents)Wait 10s and retry
VALIDATION_FAILEDYAML frontmatter validation failureFix parameters and retry
RESOURCE_NOT_FOUNDFile / data does not existCheck path; escalate if unrecoverable
CONTEXT_OVERFLOWLong session context exceeds limitCompress and retry, or process in chunks
SUBAGENT_FAILEDPhase 1 subagent failedCheck subagent logs; retry at most once

Escalation Conditions

  • Same error_code fails 2 times in a row → force escalate on the 3rd
  • retry_count reaches max_retries → escalate
  • Non-recoverable errors (PERMISSION_DENIED, SECURITY_BLOCKED, etc.) → escalate immediately

Fallback Chain

PrimaryFallbackCondition
memory_searchexec + grep/ripgrepAPI_TIMEOUT / RATE_LIMITED
kimi_fetchweb_fetchAPI_TIMEOUT / NETWORK_ERROR
read (large file)read + offset/limitCONTEXT_OVERFLOW

If-Then Failure Mode Fallbacks

ConditionTrigger ScenarioAction
User selects [skip]User explicitly declines in Auto-Draft modeImmediately discard draft; do not save; do not spawn subagents; flow terminates
compound_score < 15 and user doesn't insistLow-value problem; user has no strong desire to recordOnly display draft content; do not pre-recommend [1]; wait for user to actively choose
memory/.planning/ is not writableDirectory permission / path error during Phase 4 project integrationFall back to /tmp/c31-compound-fallback/ for temporary save; prompt user to migrate manually
Related doc search times outPhase 0.5 memory_search times out or API failsSkip Phase 0.5; proceed directly to Phase 1; subagents handle context on their own

Anti-Pattern Blacklist

The following anti-patterns are strictly forbidden during C31-compound execution:

  1. ❌ Never record unverified solutions
    • User says "should be fine" but hasn't actually tested it → do not record; mark as pending_verification
    • Must see "solved" / "verified" or equivalent confirmation before entering draft flow
  2. ❌ Never skip user confirmation in Auto-Draft mode
    • Even a draft must be shown to the user with [1]-[4] options
    • Silent saving is forbidden; bypassing pre-select recommendation logic is forbidden
  3. ❌ Never modify the original SKILL.md file content
    • compound only writes to memory/solutions/; it does not modify skills/C31-compound/SKILL.md
    • If a bug is found in the skill itself → go through the normal fix process; do not patch it via compound
  4. ❌ Never record "solutions" from pure casual chat / emotional expressions
    • "I understand" / "I see" / "Thanks" → do not trigger compound
    • There must be a reusable technical / process / cognitive output
  5. ❌ Never forcefully save when user explicitly says "don't record / skip"
    • User selects [skip] → immediately discard draft; do not write to any file
    • User says "stop recording" / "no need to record" → equivalent to [skip]; do not ask again or try to retain

Blacklist Violation Consequences

ViolationConsequence
Items 1, 4Draft is invalid; do not enter Phase 2
Items 2, 5User trust degrades; future auto-invoke sensitivity decreases
Item 3Skill system contamination; requires manual rollback

Auto-Invoke

<auto_invoke> <trigger_phrases>

  • "that worked"
  • "it's fixed"
  • "working now"
  • "problem solved"
  • "solved"
  • "fixed"
  • "root cause"
  • "解决了"
  • "搞定了"
  • "原来是因为"
  • "根因是"
  • "终于找到原因"
  • "原来要这样"
  • "没想到是"
  • "错在" </trigger_phrases> <manual_override> Invoke with: "compound this" or "document this solution" or "记录" </manual_override> </auto_invoke>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.