layered-context

layered-context is a skill for Claude Code, Codex from myths-labs/muse. It costs 23 tokens per session (931 once invoked), scanned A, original, MIT.

A three-level method for loading project notes and files, starting with short summaries and loading detailed information only when needed. It is designed for projects that use Markdown files to store context.

In plain words
What is it for?
Scanning brief role summaries, loading the current role’s full instructions, and searching memory, code, or documentation for deeper details on demand.
Why use it?
It avoids loading every project note during session recovery, which reduces unnecessary context and token use.

Skill for Claude CodeCodex

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

Good fit Scanning brief role summaries, loading the current role’s full instructions, and searching memory, code, or documentation for deeper details on demand.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/myths-labs/muse/layered-context
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.

Any agent
npx skills add myths-labs/muse --skill layered-context
Clone the repo
git clone --depth 1 https://github.com/myths-labs/muse

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 layered-context

README.md
[![agentmods](https://agentmods.dev/badge/skills/myths-labs/muse/layered-context/github.svg)](https://agentmods.dev/skills/myths-labs/muse/layered-context)
Your own site
<a href="https://agentmods.dev/skills/myths-labs/muse/layered-context"><img src="https://agentmods.dev/badge/skills/myths-labs/muse/layered-context/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for layered-context

Your own site · 80×15
<a href="https://agentmods.dev/skills/myths-labs/muse/layered-context"><img src="https://agentmods.dev/badge/skills/myths-labs/muse/layered-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 931 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00023 $0.00931
Opus 5 $0.00012 $0.00465
Sonnet 5 $0.00005 $0.00186
Haiku 4.5 $0.00002 $0.00093

Measured yesterday against content hash d1046d085764, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

layered-context 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 yesterday.

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/layered-context/SKILL.md · 96 lines

How it starts

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

Layered Context Loading Protocol

Inspired by OpenViking (ByteDance) L0/L1/L2 architecture. Adapted for MUSE's on-demand Markdown context loading.

Why

Full-loading all .muse/*.md files during /resume wastes tokens when the Agent only needs one role's context. The layered approach loads minimum context first, then deepens on demand.

Three Layers

Layer Token Budget Content When to Load
L0 ~100 tokens One-line HTML comment at top of each .muse/*.md Always — scan ALL role files
L1 ~2K tokens Full role file content On demand — only the CURRENT role's file
L2 Unbounded memory/*.md + code files + docs On demand — grep search when needed

L0 Format

Every .muse/*.md file MUST have an L0 comment as the first line:

<!-- L0: v2.10.1 | P0=竞品技术吸收, P1/P2全清, QA PASS, S036已接收 -->

L0 Content Rules

  1. Max 120 characters (excluding <!-- L0: and -->)
  2. Must include: current version + top priority + blocking issues
  3. Pipe-separated sections: version | priorities | status
  4. Updated every /bye — when the role file is synced

L0 Examples

<!-- L0: v2.10.1 | P0=竞品技术吸收(mem0/OpenViking), P1全清, QA 10/10 PASS -->
<!-- L0: 9/9渠道已发, Show HN暂缓, S040梗图排期中, Stars=2 -->
<!-- L0: 最近QA全PASS(10/10 v2.3), 无待修FAIL, QA清洁状态 -->

Boot Sequence with Layered Loading

/resume [role]
  │
  ├─① Read CLAUDE.md + MEMORIES.md (constitutional layer, always)
  │
  ├─② Scan ALL .muse/*.md L0 lines (grep "<!-- L0:" .muse/*.md)
  │   → Get one-liner status of every role in ~400 tokens total
  │
  ├─③ Deep-read CURRENT role's .muse/*.md (L1, full file)
  │   → Only the file matching /resume [role]
  │
  ├─④ Scan memory/ for unfinished items (L2, on demand)
  │   → grep 🔲 and [ ] in recent memory files
  │
  └─⑤ grep strategy.md for 🟡 directives (L2, on demand)
      → Only if non-strategy role

Decision Tree: When to Upgrade

Read the full file on GitHub · 96 lines

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. yesterday Changed d1046d085764
  2. 8d ago First seen · 96 lines · 23 tokens per session scan A e16b6ee61ee9

Subscribe to this mod's changes

layered-context is a skill published in the GitHub repository myths-labs/muse (32 stars, last pushed 2d ago), licensed MIT. It adds 23 tokens to every session and 931 once invoked, about $0.0001 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-30.