C31-context-engineering
Skill1 starsChanged 3 months agoMITView on GitHub
context, 上下文, 变蠢 | 上下文工程:在正确的时间给AI正确的信息,解决200K窗口组织不善问题
In this repository56 other files it gives its agents.
- C31-1stSkill
- C31-adopt-projectSkill
- C31-brainstormSkill
- C31-coding-disciplineSkill
- C31-compound-refreshSkill
- C31-compoundSkill
- C31-curatorSkill
- c31-daily-intelSkill
- C31-debugSkill
- c31-devSkill
- C31-grillSkill
- C31-lfgSkill
- C31-planSkill
- C31-researchSkill
- C31-specSkill
- C31-stormSkill
- C31-strategySkill
- C31-workflow-bug-reproductionSkill
- C31-workSkill
- rl-workflowSkill
- C31-cvideoSkill
- c31-loopSkill
- c31-sxsSkill
- teachSkill
- video-content-analysisSkill
- agent-reachSkill
- kimiimSkill
- skillhub-preferenceSkill
- c31-communitySkill
- c31-growSkill
- c31-gutcheckSkill
- c31-marketSkill
- c31-mvpSkill
- c31-priceSkill
- c31-processSkill
- c31-sellSkill
- c31-validateSkill
- c31-valuesSkill
- growth-hackerSkill
- c31-improve-codebase-architectureSkill
- C31-multi-reviewSkill
- C31-review-adversarialSkill
- C31-review-architectureSkill
- C31-review-securitySkill
- C31-reviewSkill
- c31-wizardSkill
- external-privacy-guardSkill
- find-skillsSkill
- gsd-map-codebaseSkill
- gsd-new-projectSkill
- gsd-progressSkill
- gsd-quickSkill
- gsd-shipSkill
- humanize-aiSkill
- time-awarenessSkill
- worker-safetySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Every session → load core.md (always)
- Very specific: line 61
Read the corresponding SKILL.md only when user input matches a trigger phrase
- Distinctive: line 62
Do not "preload all skills"
- Distinctive: line 121
When you're about to say "keep it just in case," consult this table:
- Distinctive: line 140
Before solving a new problem, check if a solution already exists
- Distinctive: line 143
Before debugging a bug, search for similar existing records
- Distinctive: line 180
Read L3 Rules layer (core.md + on-demand sub-files)
- Distinctive: line 181
Read L2 Working layer (current project STATE.md + PLAN.md)
- Distinctive: line 183
If >35%: report status, suggest completing current task before starting a new one
- Distinctive: line 188
When historical information is needed → trigger memory_search or gbrain think
- Distinctive: line 189
After task completion → update STATE.md, clean up expired intermediate files in L2
- Distinctive: line 190
When a solution worth recording is found → trigger compound flow
- Distinctive: line 222
When asked to check context health:
≈ “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.
Files
Multilingual Triggers
| Language | Trigger phrases |
| EN | context, 上下文, 信息组织, 变蠢, context engineering, 信息太多, 你好像忘了, 上下文不够了 |
| ZH | 上下文工程, 管理上下文 |
| JA | コンテキストエンジニアリング, コンテキスト管理 |
Output language: Respond automatically in the user's conversation language.
C31 Context Engineering
The core pain point of the C31 system: a 200K context window, but with poor information organization = effective capacity of only ~30K.
This is not a capacity problem — it is an information structure problem.
Core Principles
- Layered loading — Not all information is worth loading
- On-demand retrieval — GBrain searches only when needed, not on every call
- Active discarding — Expired, completed, or irrelevant information is cleaned up promptly
- Anti-rationalization — Do not retain information "just in case"
Information Layering Architecture (Four-Layer Model)
| Layer | Content | When to Load | Discard Condition |
| L1 Immediate | Current conversation, task instructions for this turn, active tool calls | Always loaded | Discard when conversation ends |
| L2 Working | Current project files (STATE.md, PLAN.md, CONTEXT.md), active todos | Load at session start | On project switch or completion |
| L3 Rules | AGENTS.md, SKILL.md, SOUL.md, USER.md | Load on-demand at session start | Replace when rules are updated |
| L4 Memory | Historical knowledge, solutions, past projects, long-term memory | Search only when needed | Never proactively loaded |
Hard rule: L4 is never automatically injected into context. It must be explicitly retrieved via GBrain search or memory_search.
Rules Files Management
On-Demand Loading Strategy
AGENTS.md uses modular splits (core.md, decision-boundary.md, communication.md, workflow.md).
Loading rules:
- Every session → load
core.md(always) - Involves decisions/permissions → load
decision-boundary.md - Involves message format/platform → load
communication.md - Involves scheduling/cron/heartbeat → load
workflow.md - Sub-files not relevant to the current task are not loaded
SKILL Trigger Management
- Read the corresponding SKILL.md only when user input matches a trigger phrase
- Do not "preload all skills"
- Subagents only receive the SKILL.md content they actually need
Context Packing
Packing Principles
- Summary over full text — 10 pages of conversation → 3-line summary + key conclusions
- Structured over narrative — Use tables, lists, YAML frontmatter instead of long paragraphs
- Reference over copy — "See PLAN.md Phase 3" is better than copying Phase 3 in full
- State over history — "Current state: X" is better than "how we got from Y to X"
Packing Operations
At session start:
1. Read session_state.json (if present)
2. Read active project files (PROJECT.md + STATE.md + current PLAN.md)
3. Assess context usage → if >35%, skip non-critical files
4. If >50%, ask user whether to /clearOn task switch:
1. Save current task state to STATE.md
2. Unload old task's L2 files
3. Load new task's L2 files
4. Retain L1 immediate layer (conversation continuity)Information Discard Strategy (Active Forgetting)
Discard Decision Tree
Does this information affect the current decision?
├── Yes → Retain (L1/L2)
└── No → Is this information long-term knowledge?
├── Yes → Write to memory/solutions/ or GBrain; discard from context
└── No → Discard immediatelySpecific Discard Rules
| Scenario | Action |
| Task completed with no further dependencies | Unload from L2; record to MILESTONES.md |
| Conversation resolved with no new knowledge | Do not retain conversation history; only keep conclusion |
| Debugging a fixed bug | Worth recording → compound; not worth it → discard |
| Temporary files / intermediate artifacts | Delete immediately or mark as cleanable |
| Expired schedules / reminders | Archive or delete; do not retain in active context |
| Merged PRs / closed issues | Reference by number only; do not retain details |
Anti-Rationalization Table
When you're about to say "keep it just in case," consult this table:
| Excuse | Rebuttal | Correct Action |
| "Might need it later" | It can be retrieved from GBrain/memory_search when needed | Discard; retrieve when needed |
| "This information is special" | Special information should be compounded into long-term storage | Write to solutions; discard |
| "It took a lot of effort to produce" | Sunk cost is not a reason to retain | Extract conclusion; discard process |
| "User emphasized this before" | What the user emphasized is already in USER.md | Reference USER.md; don't keep the original conversation |
| "Keeping it doesn't take much space" | Mental occupation is more fatal than token occupation | Clean it up; maintain clarity |
| "I'll organize after this project is done" | It will never be "done" | Summarize or discard now |
GBrain Integration Rules
Retrieval Trigger Conditions
Must search GBrain/memory when:
- User mentions "said before", "did before", "wasn't this already done"
- Before solving a new problem, check if a solution already exists
- Involves past project decisions or technology choices
- User asks "why did I choose this"
- Before debugging a bug, search for similar existing records
Do NOT search when:
- User is asking about general knowledge (unless related to a historical project)
- Current task is completely independent with no historical connection
- Context already contains the required information
Post-Retrieval Processing
1. memory_search returns results
2. Assess relevance: directly relevant / indirectly relevant / unrelated
3. Directly relevant → extract key info, inject summary into context
4. Indirectly relevant → record reference; do not inject full text
5. Unrelated → ignore; do not retain because it "might be useful"Context Budget Management Integration
Connects with the threshold system in AGENTS.md:
| Context Usage | Strategy |
| > 35% | Warning: avoid starting complex new work; prioritize completing current task |
| > 50% | Suggest /clear or new session; if continuing → write continue-here.md |
| > 70% | Force cleanup: discard all non-critical L2 files; retain L1 + current PLAN.md only |
| > 85% | Emergency mode: stop work, save state, request new session |
Execution Flow
At Session Start
- Load session_state.json (restore active projects)
- Read L3 Rules layer (core.md + on-demand sub-files)
- Read L2 Working layer (current project STATE.md + PLAN.md)
- Calculate context usage
- If >35%: report status, suggest completing current task before starting a new one
- Do not load any L4 memory (unless session_state.json explicitly requires it)
During Task Execution
- When historical information is needed → trigger memory_search or gbrain think
- After task completion → update STATE.md, clean up expired intermediate files in L2
- When a solution worth recording is found → trigger compound flow
Before Session End (user says "that's it for today" / long idle period)
- Save session_state.json (active projects, todos, pending decisions)
- Summarize key decisions from this turn to STATE.md
- Clean up all temporary / intermediate artifacts
- Confirm that L4-worthy information has been compounded
Anti-Rationalization Commitment
"I commit not to hoard information out of anxiety. I trust the retrieval system. I trust that when information is needed, it will come back."
Discarding takes more courage than retaining. A clean context beats 100K of redundant information.
Trigger Phrases
- "context", "上下文", "信息组织", "变蠢"
- "context engineering", "信息太多"
- "AI怎么变笨了", "你好像忘了"
- "之前不是说过", "上下文不够了"
- "清理上下文", "精简上下文"
- "为什么你不记得", "搜索一下记忆"
Output Format
When asked to check context health:
📊 Context Health Report
Usage: X% (X / 200K tokens)
L1 Immediate: [summary]
L2 Working: [active projects/files]
L3 Rules: [loaded rules]
L4 Memory: [not loaded, retrievable]
Recommendation: [maintain / clean up / suggest new session]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
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.

