C31-context-engineering

C31-context-engineering is a skill for Claude Code, Codex from ChianW/C31. It costs 40 tokens per session (2,109 once invoked), scanned A, original, MIT.

A method for organizing information in an AI coding session so the most relevant details are loaded when needed. It divides information into layers and removes expired or irrelevant context.

In plain words
What is it for?
Use it to manage conversation history, project notes, active plans, and searchable background information during longer coding tasks.
Why use it?
A large context window—the amount of text an AI can consider—can still work poorly when it is cluttered. This approach helps keep active tasks and project details easier to retrieve.

Skill for Claude CodeCodex

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-context-engineering
Any agent
npx skills add ChianW/C31 --skill c31-context-engineering
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-context-engineering

README.md
[![agentmods](https://agentmods.dev/badge/skills/chianw/c31/c31-context-engineering.svg)](https://agentmods.dev/skills/chianw/c31/c31-context-engineering)
Your own site
<a href="https://agentmods.dev/skills/chianw/c31/c31-context-engineering"><img src="https://agentmods.dev/badge/skills/chianw/c31/c31-context-engineering.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,109 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 $0.00040 $0.02109
Opus 5 $0.00020 $0.01055
Sonnet 5 $0.00008 $0.00422
Haiku 4.5 $0.00004 $0.00211

Measured 4d ago against content hash c2a5fb1dac43, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

C31-context-engineering 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 4d 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-context-engineering/SKILL.md · 233 lines

How it starts

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

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

  1. Layered loading — Not all information is worth loading
  2. On-demand retrieval — GBrain searches only when needed, not on every call
  3. Active discarding — Expired, completed, or irrelevant information is cleaned up promptly
  4. 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

Read the full file on GitHub · 233 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. 4d ago First seen · 233 lines · 40 tokens per session scan A c2a5fb1dac43

Subscribe to this mod's changes

C31-context-engineering is a skill published in the GitHub repository ChianW/C31 (1 stars, last pushed 9d ago), licensed MIT. It adds 40 tokens to every session and 2,109 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.