Skip to content

Commit 49e5cfb

Browse files
committed
Release opus-context v1.0.0
2 parents 1e67e2c + e2cb0a5 commit 49e5cfb

8 files changed

Lines changed: 303 additions & 0 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@
159159
},
160160
"source": "./plugins/python-dev",
161161
"homepage": "https://github.com/L3DigitalNet/Claude-Code-Plugins/tree/main/plugins/python-dev"
162+
},
163+
{
164+
"name": "opus-context",
165+
"description": "Teaches Claude Code Opus 4.6 to aggressively leverage its 1M token context window through always-on behavioral rules and deep-context planning for complex tasks.",
166+
"version": "1.0.0",
167+
"author": {
168+
"name": "L3DigitalNet",
169+
"url": "https://github.com/L3DigitalNet"
170+
},
171+
"source": "./plugins/opus-context",
172+
"homepage": "https://github.com/L3DigitalNet/Claude-Code-Plugins/tree/main/plugins/opus-context"
162173
}
163174
]
164175
}

.release-waivers.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
"check": "missing_tests",
8585
"plugin": "python-dev",
8686
"reason": "Markdown/skill-only plugin — 11 knowledge files and one command with no executable test suite by design"
87+
},
88+
{
89+
"check": "missing_tests",
90+
"plugin": "opus-context",
91+
"reason": "Skill-only plugin — one behavioral skill file and one hook script with no executable test suite by design"
8792
}
8893
]
8994
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "opus-context",
3+
"version": "1.0.0",
4+
"description": "Teaches Claude Code Opus 4.6 to aggressively leverage its 1M token context window through always-on behavioral rules and deep-context planning for complex tasks.",
5+
"author": {
6+
"name": "L3DigitalNet",
7+
"url": "https://github.com/L3DigitalNet"
8+
}
9+
}

plugins/opus-context/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
6+
7+
## [1.0.0] - 2026-03-15
8+
9+
### Added
10+
11+
- deep-context skill with five baseline rules for aggressive context utilization
12+
- Deep-context planning mode for complex multi-file tasks
13+
- Five anti-pattern definitions to prevent conservative context behaviors
14+
- Context budget awareness with heuristic-based thresholds
15+
- SessionStart hook with terminal banner

plugins/opus-context/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# opus-context
2+
3+
Teaches Claude Code Opus 4.6 to use its full 1M token context window instead of defaulting to conservative behaviors designed for smaller models.
4+
5+
## Summary
6+
7+
Claude Code defaults to reading files in small chunks, delegating searches to subagents, and re-reading files it already has in context. These habits make sense for 200K-token models but waste Opus 4.6's capacity. This plugin provides always-on behavioral rules that override those defaults: read whole files, read directly instead of delegating, pre-load dependencies before editing, and track what's already loaded.
8+
9+
## Principles
10+
11+
**[P1] Read More, Not Less**: With 1M tokens, a 500-line file costs ~0.1% of context. The cost of missing context from partial reads exceeds the cost of loading the full file.
12+
13+
**[P2] Own Your Context**: Read files directly rather than delegating to subagents that return summaries. Summaries lose nuance; source code doesn't.
14+
15+
**[P3] Load Before You Leap**: Read a file's dependency graph (imports, callers, tests) before editing it. Never discover mid-edit that you need context you don't have.
16+
17+
**[P4] Budget Awareness**: Read aggressively early; shift to selective reading as context fills. Don't run out of context on long sessions.
18+
19+
## Requirements
20+
21+
None beyond Claude Code with Opus 4.6 (1M context).
22+
23+
## Installation
24+
25+
```bash
26+
/plugin marketplace add L3DigitalNet/Claude-Code-Plugins
27+
/plugin install opus-context@l3digitalnet-plugins
28+
```
29+
30+
For local development or testing without installing:
31+
32+
```bash
33+
claude --plugin-dir ./plugins/opus-context
34+
```
35+
36+
## How It Works
37+
38+
```mermaid
39+
flowchart TD
40+
Task([Task received]) -->|apply| Baseline[Apply baseline rules:<br/>whole-file reads, no re-reads,<br/>parallel reads, direct over delegation]
41+
Baseline --> Complex{Complex task?<br/>3+ files, debugging,<br/>new feature, refactor}
42+
Complex -->|No| Execute[Execute with baseline rules]
43+
Complex -->|Yes| Scope[Step 1: Scope file graph<br/>via Glob/Grep]
44+
Scope --> Load[Step 2: Load strategically<br/>in priority-ordered parallel batches]
45+
Load --> DeepExec[Step 3: Execute with<br/>full context loaded]
46+
Execute --> Budget{Context pressure?}
47+
DeepExec --> Budget
48+
Budget -->|Low| Continue((Continue<br/>aggressively))
49+
Budget -->|High| Conserve((Shift to<br/>selective reads))
50+
```
51+
52+
## Usage
53+
54+
This skill is always-on. It activates automatically via skill description matching whenever Claude Code processes a task. No manual invocation needed.
55+
56+
Optional CLAUDE.md reinforcement (add to your global `~/.claude/CLAUDE.md`):
57+
58+
```markdown
59+
## Context Management
60+
61+
When running on Opus 4.6 (1M context), always consult the `opus-context:deep-context` skill for file reading, delegation, and pre-loading decisions.
62+
```
63+
64+
## Skills
65+
66+
| Skill | Loaded when |
67+
|-------|-------------|
68+
| `deep-context` | Always, via broad description matching. Governs file reading, subagent delegation, and pre-loading decisions. |
69+
70+
## Hooks
71+
72+
All hooks are registered declaratively via `hooks/hooks.json`.
73+
74+
| Hook | Event | What it does |
75+
|------|-------|-------------|
76+
| `session-start.sh` | SessionStart | Prints a terminal banner confirming 1M context mode is active. Terminal-only; does not inject into AI context. |
77+
78+
## Design Decisions
79+
80+
- **Always-on via description, not SessionStart injection**: SessionStart hook stdout goes to the terminal, not AI context. The skill's broad `description` field is the primary activation mechanism, with optional CLAUDE.md reinforcement as a second trigger path.
81+
82+
- **Heuristic budget thresholds instead of percentages**: Claude can't measure its exact context usage. Budget awareness uses observable signals (file count, conversation length, compaction events) instead of precise percentages.
83+
84+
- **No model detection gate**: The skill's rules are framed around having abundant context. A smaller-context model that loads the skill will naturally hit budget awareness thresholds and shift conservative sooner.
85+
86+
## Planned Features
87+
88+
- **PreCompact hook**: Save a context summary before compaction so post-compaction sessions retain awareness of what was loaded.
89+
- **Read tracking**: PostToolUse hook that counts Read calls and warns when context is getting heavy.
90+
91+
## Known Issues
92+
93+
- **No runtime model detection**: The skill cannot programmatically verify it's running on Opus 4.6. If loaded on a smaller-context model, the aggressive reading rules may fill context faster than intended. The budget awareness heuristics mitigate this.
94+
95+
## Links
96+
97+
- Repository: [L3DigitalNet/Claude-Code-Plugins](https://github.com/L3DigitalNet/Claude-Code-Plugins)
98+
- Changelog: [`CHANGELOG.md`](CHANGELOG.md)
99+
- Issues and feedback: [GitHub Issues](https://github.com/L3DigitalNet/Claude-Code-Plugins/issues)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hooks": {
3+
"SessionStart": [
4+
{
5+
"matcher": "*",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh",
10+
"timeout": 10
11+
}
12+
]
13+
}
14+
]
15+
}
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Terminal banner for opus-context plugin.
3+
# SessionStart stdout goes to the terminal only (not AI context).
4+
echo "opus-context: 1M context mode active, aggressive file reading enabled"
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
name: deep-context
3+
description: >
4+
1M context window behavioral rules. MUST consult before any file reading, code editing,
5+
or subagent delegation decision. Applies to every task in Opus 4.6 sessions. Governs:
6+
whole-file reading (never use offset/limit for files under 4000 lines), direct reading
7+
over subagent delegation, pre-loading dependencies before edits, avoiding redundant
8+
re-reads, parallel file reads, and deep-context planning for complex multi-file tasks.
9+
Triggers on: read, edit, explore, debug, refactor, implement, investigate, fix, build,
10+
create, modify, change, update, add, review, analyze, understand.
11+
---
12+
13+
# Deep Context: 1M Token Context Rules
14+
15+
You have a 1M token context window. A 500-line file costs ~0.1% of your context. The cost of *not* reading is almost always higher than the cost of reading. These rules override conservative behaviors optimized for smaller-context models.
16+
17+
## Baseline Rules (Always Active)
18+
19+
### Rule 1: Whole-File Reading
20+
21+
Read entire files by default. Only use `offset`/`limit` when:
22+
- The file exceeds 4000 lines, OR
23+
- You have already identified the exact section you need and have previously read the full file
24+
25+
For files between 2000-4000 lines, use two parallel Read calls (first half + second half) to load the complete file.
26+
27+
A 500-line file is ~0.1% of your context. Partial reads cost more in missed connections than they save in tokens.
28+
29+
### Rule 2: Direct Read Over Delegation
30+
31+
Use Glob/Grep to find files, then Read them directly into your own context. Only delegate to subagents when:
32+
- The search space is genuinely unknown and broad
33+
- You need to explore 10+ files to find the right ones
34+
- The task is truly independent and parallelizable
35+
36+
**The test:** "Would I lose important nuance by reading a summary instead of the source?" If yes, read it yourself.
37+
38+
### Rule 3: Read Before Edit
39+
40+
Before editing any file, read its immediate dependency graph:
41+
1. The target file itself (full read)
42+
2. Its imports and dependencies
43+
3. Files that import or reference it (callers/consumers)
44+
4. Its test files
45+
5. Config files that reference it
46+
47+
Never start an edit without understanding what your change touches.
48+
49+
### Rule 4: No Redundant Reads
50+
51+
Trust your context. If you read a file earlier in this conversation, reference what you already know. Only re-read if:
52+
- The file was modified since you last read it (by you or a tool)
53+
- You explicitly need to verify current state after an edit
54+
55+
Do not re-read files "just to be sure."
56+
57+
### Rule 5: Parallel Reads
58+
59+
When you need multiple files, read them all in a single parallel tool call. Never issue sequential Read calls for independent files.
60+
61+
**Wrong:**
62+
```
63+
Read(file_a.py)
64+
# wait
65+
Read(file_b.py)
66+
# wait
67+
Read(file_c.py)
68+
```
69+
70+
**Right:**
71+
```
72+
Read(file_a.py) | Read(file_b.py) | Read(file_c.py) # single parallel call
73+
```
74+
75+
## Deep-Context Mode (Complex Tasks)
76+
77+
Activate this planning phase when ANY of these apply:
78+
- Task touches 3+ files
79+
- Task involves debugging or investigating unexpected behavior
80+
- Task is a new feature or significant refactoring
81+
- Task crosses module/package boundaries
82+
- User explicitly requests deep analysis
83+
84+
### Step 1: Scope the File Graph
85+
86+
Use Glob and Grep to identify all files relevant to the task. Map what imports what, what tests what, what configs reference what. This is a *search* phase -- use lightweight tools, don't read files yet.
87+
88+
### Step 2: Load Strategically
89+
90+
Read files in priority order, using parallel batches:
91+
92+
1. **Primary targets** -- files being modified
93+
2. **Direct dependencies** -- imports, base classes, interfaces
94+
3. **Callers/consumers** -- files that reference the targets
95+
4. **Tests** -- existing test files
96+
5. **Config/docs** -- manifests, READMEs, config files
97+
98+
For a typical task: 5-15 files in 2-3 parallel batches.
99+
100+
### Step 3: Execute with Full Context
101+
102+
Implement the change with the full picture loaded. No mid-task "let me check..." reads -- you should already have what you need.
103+
104+
Briefly tell the user what you loaded: "Loaded X, Y, Z to understand the full picture."
105+
106+
## Anti-Patterns
107+
108+
### "Let me check that with a subagent"
109+
**Wrong:** Spawning an Explore agent to find and summarize code you could read directly.
110+
**Right:** Glob for the pattern, Read the matches yourself.
111+
**Exception:** Genuinely broad research across 10+ unknown files.
112+
113+
### "Let me read lines 1-50 first"
114+
**Wrong:** `Read(file, offset=0, limit=50)` to "peek" at a file.
115+
**Right:** `Read(file)` for files under 4000 lines.
116+
117+
### "Let me read this file again"
118+
**Wrong:** Re-reading a file already in your context.
119+
**Right:** Reference your existing knowledge. Re-read only if the file was modified.
120+
121+
### "I'll start coding and figure out imports later"
122+
**Wrong:** Editing before reading dependencies.
123+
**Right:** Read target + imports + tests + callers, then edit.
124+
125+
### "I'll read these files one at a time"
126+
**Wrong:** Sequential Read calls for independent files.
127+
**Right:** Batch all independent reads into one parallel tool call.
128+
129+
## Context Budget Awareness
130+
131+
Use these heuristics to gauge context pressure and shift strategy:
132+
133+
| Signal | Strategy | Behavior |
134+
|--------|----------|----------|
135+
| **Early session** (few files, short conversation) | Aggressive | Load everything potentially relevant. Read whole files freely. |
136+
| **Mid session** (10-20 files loaded, several tasks done) | Selective | Focus on files directly touched by the current task. |
137+
| **Heavy session** (30+ files, long conversation, compaction warnings) | Deliberate | Only read what's strictly needed. Prefer Grep for quick lookups. |
138+
| **Approaching limit** (compaction occurred, system pressure signals) | Conserve | Stop loading new content. Work with what you have. Suggest new session. |
139+
140+
## Guardrails
141+
142+
- **Don't read blindly.** "Read aggressively" does not mean "read the whole repo." Have a reason for each file.
143+
- **Match scope to task.** "Fix this one line" doesn't need the entire module graph loaded.
144+
- **Communicate loading.** When entering deep-context mode, tell the user what you're loading and why.

0 commit comments

Comments
 (0)