docs: SonnetPlan hack — budget Sonnet+Haiku hybrid via env var remap
- guide/ultimate-guide.md §OpusPlan: new "Budget Variant: SonnetPlan" section with shell function, Plan/Act routing table, caveat on unreliable model self-report, link to GitHub issue #9749 - examples/scripts/sonnetplan.sh: new ready-to-use shell function with installation instructions and verification guidance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
16e3275240
commit
01283fafec
5 changed files with 110 additions and 16 deletions
|
|
@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- **SonnetPlan hack documenté** (`guide/ultimate-guide.md` §OpusPlan Mode) — variante budget Sonnet→Haiku via remap `ANTHROPIC_DEFAULT_OPUS_MODEL` + `ANTHROPIC_DEFAULT_SONNET_MODEL` : fonction shell `sonnetplan()`, routing Plan/Act, caveat self-report non fiable, lien issue GitHub [#9749](https://github.com/anthropics/claude-code/issues/9749). Nouveau template `examples/scripts/sonnetplan.sh` avec instructions d'installation et note de vérification (status bar vs self-report).
|
||||
|
||||
- **Auto-memory documentée comme 3e système de mémoire natif** (`guide/ultimate-guide.md` §Session vs Persistent Memory) — passage de 2 à 3 systèmes (session / auto-memory native / Serena MCP), nouveau tableau 5×4, section dédiée "Auto-Memory (native, v2.1.59+)" avec chemin MEMORY.md et gestion `/memory`. Correction : l'ancienne description liait `/memory` à CLAUDE.md (inexact) et ignorait le système natif. Guidance "When to use which" mise à jour.
|
||||
- **`/memory` et `/copy` — descriptions commandes mises à jour** (`guide/ultimate-guide.md` §Command Reference) — `/memory` : corrigé vers auto-memory + MEMORY.md (v2.1.59+). `/copy` : enrichi avec picker interactif de blocs de code et option "Always copy full response" (v2.1.59+).
|
||||
|
||||
- **`/batch` mis en avant** (`guide/cheatsheet.md`, `whitepapers/fr/07`, `whitepapers/fr/08`, `whitepapers/en/07`, `whitepapers/en/08`) — `/batch` = 5-30 agents parallèles dans des worktrees Git isolés, chacun ouvre une PR. Sections dédiées dans les whitepapers 07 (table /batch vs agent teams manuelles) et 08 (native alternative). Cheatsheet mise à jour avec `/simplify` + `/batch`.
|
||||
|
||||
- **skills.sh security audits** (`guide/ultimate-guide.md` §Skills Marketplace) — nouvelle sous-section "Security Audits (February 2026)" : 3 partenaires indépendants (Socket analyse statique 97% F1, Snyk mcp-scan 0% faux positifs, Gen Agent Trust Hub monitoring continu), 4 niveaux de risque (Safe/Low/High/Critical), monitoring post-install, mental model "skill = dépendance exécutable". Trade-offs mis à jour : suppression warning "Early stage", ajout ✅ audits automatisés + monitoring continu. 3 références sources ajoutées (Vercel changelog, Snyk blog, Gen/PRNewswire). Source : [Vercel, 17 fév 2026](https://vercel.com/changelog/automated-security-audits-now-available-for-skills-sh).
|
||||
|
||||
## [3.29.2] - 2026-03-02
|
||||
|
|
|
|||
32
examples/scripts/sonnetplan.sh
Normal file
32
examples/scripts/sonnetplan.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
# sonnetplan — Budget hybrid mode: Sonnet 4.6 (plan) + Haiku 4.5 (act)
|
||||
#
|
||||
# How it works:
|
||||
# Claude Code's `opusplan` alias routes to Opus (plan) + Sonnet (act).
|
||||
# By remapping the environment variables that resolve the `opus` and `sonnet`
|
||||
# aliases, we effectively create a cheaper Sonnet→Haiku hybrid.
|
||||
#
|
||||
# Usage:
|
||||
# sonnetplan # Start Claude in current directory
|
||||
# sonnetplan --project /path # Start in specific project
|
||||
#
|
||||
# Installation:
|
||||
# Add this function to your ~/.zshrc or ~/.bashrc:
|
||||
#
|
||||
# source /path/to/sonnetplan.sh
|
||||
#
|
||||
# Or copy the function body directly into your shell config.
|
||||
#
|
||||
# Verification:
|
||||
# After running `sonnetplan` and typing `/model opusplan`, check the
|
||||
# status bar — it should show "Model: Sonnet 4.6" in plan mode.
|
||||
# Do NOT rely on asking the model "what model are you?" — that self-report
|
||||
# is unreliable. Use the status bar or your billing dashboard instead.
|
||||
#
|
||||
# GitHub issue tracking native support: https://github.com/anthropics/claude-code/issues/9749
|
||||
|
||||
sonnetplan() {
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-sonnet-4-6 \
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-haiku-4-5-20251001 \
|
||||
claude "$@"
|
||||
}
|
||||
|
|
@ -29,6 +29,8 @@ tags: [cheatsheet, reference]
|
|||
| `/execute` | Exit Plan Mode (apply changes) |
|
||||
| `/model` | Switch model (sonnet/opus/opusplan) |
|
||||
| `/insights` | Usage analytics + optimization report |
|
||||
| `/simplify` | Detect over-engineering in changed code + auto-fix |
|
||||
| `/batch` | Large-scale refactors via 5–30 parallel worktree agents |
|
||||
| `/teleport` | Teleport session from web |
|
||||
| `/tasks` | Monitor background tasks |
|
||||
| `/remote-env` | Configure cloud environment |
|
||||
|
|
|
|||
|
|
@ -1567,14 +1567,15 @@ When approaching the red zone (75%+), `/compact` alone may not be enough. You ne
|
|||
|
||||
### Session vs. Persistent Memory
|
||||
|
||||
Claude Code has two distinct memory systems. Understanding the difference is crucial for effective long-term work:
|
||||
Claude Code has three distinct memory systems. Understanding the difference is crucial for effective long-term work:
|
||||
|
||||
| Aspect | Session Memory | Persistent Memory |
|
||||
|--------|----------------|-------------------|
|
||||
| **Scope** | Current conversation only | Across all sessions |
|
||||
| **Managed by** | `/compact`, `/clear` | `/memory` command, CLAUDE.md files |
|
||||
| **Lost when** | Session ends or `/clear` | Explicitly deleted from files |
|
||||
| **Use case** | Immediate working context | Long-term decisions, patterns |
|
||||
| Aspect | Session Memory | Auto-Memory (native) | Persistent Memory (Serena) |
|
||||
|--------|----------------|----------------------|---------------------------|
|
||||
| **Scope** | Current conversation only | Across sessions, per-project | Across all sessions |
|
||||
| **Managed by** | `/compact`, `/clear` | `/memory` command (automatic) | `write_memory()` via Serena MCP |
|
||||
| **Lost when** | Session ends or `/clear` | Explicitly deleted via `/memory` | Explicitly deleted from Serena |
|
||||
| **Requires** | Nothing | Nothing (v2.1.59+) | [Serena MCP server](#82-available-servers) |
|
||||
| **Use case** | Immediate working context | Key decisions, context snippets | Architectural decisions, patterns |
|
||||
|
||||
**Session Memory** (short-term):
|
||||
- Everything in your current conversation
|
||||
|
|
@ -1582,7 +1583,14 @@ Claude Code has two distinct memory systems. Understanding the difference is cru
|
|||
- Managed with `/compact` (compress) and `/clear` (reset)
|
||||
- Disappears when you close Claude Code
|
||||
|
||||
**Persistent Memory** (long-term):
|
||||
**Auto-Memory** *(native, v2.1.59+)*:
|
||||
- Built into Claude Code — no MCP server or configuration required
|
||||
- Claude automatically saves useful context (decisions, patterns, preferences) to `MEMORY.md` files
|
||||
- Organized per-project: `.claude/memory/MEMORY.md` or `~/.claude/projects/<path>/memory/MEMORY.md`
|
||||
- Managed with `/memory`: view, edit, or delete what's been saved
|
||||
- Survives across sessions automatically
|
||||
|
||||
**Persistent Memory** (long-term, Serena MCP):
|
||||
- Requires [Serena MCP server](#82-available-servers) installed
|
||||
- Explicitly saved with `write_memory("key", "value")`
|
||||
- Survives across sessions
|
||||
|
|
@ -1606,7 +1614,8 @@ Claude Code has two distinct memory systems. Understanding the difference is cru
|
|||
|
||||
**When to use which**:
|
||||
- **Session memory**: Active problem-solving, debugging, exploration
|
||||
- **Persistent memory**: Decisions you'll need in future sessions
|
||||
- **Auto-memory**: Decisions and context you want Claude to rediscover next session without manual effort (v2.1.59+)
|
||||
- **Persistent memory (Serena)**: Structured key-value store for architectural decisions across many projects
|
||||
- **CLAUDE.md**: Team conventions, project structure (versioned with git)
|
||||
|
||||
### Fresh Context Pattern (Ralph Loop)
|
||||
|
|
@ -2515,6 +2524,25 @@ tools: Write, Edit, Bash
|
|||
|
||||
**Pro Users Note**: OpusPlan is particularly valuable for Pro subscribers with limited Opus tokens. It lets you leverage Opus reasoning for critical planning while preserving tokens for more sessions.
|
||||
|
||||
**Budget Variant: SonnetPlan (Community Hack)**
|
||||
|
||||
`opusplan` is hardcoded to Opus+Sonnet — there's no native `sonnetplan` alias. But you can remap what the `opus` and `sonnet` aliases resolve to via environment variables, effectively creating a Sonnet→Haiku hybrid:
|
||||
|
||||
```bash
|
||||
# Add to ~/.zshrc
|
||||
sonnetplan() {
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-sonnet-4-6 \
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-haiku-4-5-20251001 \
|
||||
claude "$@"
|
||||
}
|
||||
```
|
||||
|
||||
With `sonnetplan`, `/model opusplan` routes:
|
||||
- **Plan Mode** → Sonnet 4.6 (via remapped `opus` alias)
|
||||
- **Act Mode** → Haiku 4.5 (via remapped `sonnet` alias)
|
||||
|
||||
> **Caveat**: The model's self-report (`what model are you?`) is unreliable — models don't always know their own identity. Trust the status bar (`Model: Sonnet 4.6` in plan mode) or verify via billing dashboard. GitHub issue [#9749](https://github.com/anthropics/claude-code/issues/9749) tracks native support.
|
||||
|
||||
### Rev the Engine
|
||||
|
||||
**Concept**: Run multiple rounds of planning and deep thinking before executing. Like warming up an engine before driving.
|
||||
|
|
@ -19859,7 +19887,7 @@ _Quick jump:_ [Commands Table](#101-commands-table) · [Keyboard Shortcuts](#102
|
|||
| `/feedback` | Report bugs or send feedback to Anthropic | Support |
|
||||
| `/chrome` | Check Chrome connection, manage permissions | Mode |
|
||||
| `/config` | View and modify global settings | Config |
|
||||
| `/copy` | Copy last response to clipboard | Session |
|
||||
| `/copy` | Copy last response to clipboard — interactive picker to select specific code blocks, or "Always copy full response" option (v2.1.59+) | Session |
|
||||
| `/debug` | Systematic troubleshooting and error investigation | Debug |
|
||||
| `/doctor` | Run diagnostics and troubleshooting checks | Debug |
|
||||
| `/execute` | Exit Plan Mode | Mode |
|
||||
|
|
@ -19870,7 +19898,7 @@ _Quick jump:_ [Commands Table](#101-commands-table) · [Keyboard Shortcuts](#102
|
|||
| `/login` | Log in to Claude account | Auth |
|
||||
| `/logout` | Log out and re-authenticate | Auth |
|
||||
| `/mcp` | Manage Model Context Protocol servers | Config |
|
||||
| `/memory` | View and edit persistent context (CLAUDE.md files) | Config |
|
||||
| `/memory` | View and edit auto-memory (context Claude automatically saved across sessions via MEMORY.md) — v2.1.59+ | Config |
|
||||
| `/mobile` | Show App Store and Google Play download links | Info |
|
||||
| `/model` | Change model (with left/right arrows for effort slider) | Mode |
|
||||
| `/permissions` | Configure permission allowlists | Config |
|
||||
|
|
|
|||
|
|
@ -1,17 +1,42 @@
|
|||
const GITHUB_BASE = 'https://github.com/FlorianBruniaux/claude-code-ultimate-guide/blob/main';
|
||||
const GUIDE_SITE_BASE = 'https://cc.bruniaux.com/guide';
|
||||
const GUIDE_SITE_BASE = 'https://cc.bruniaux.com/guide/ultimate-guide';
|
||||
|
||||
// Chapter slugs for guide/ultimate-guide.md (line ranges → chapter slug)
|
||||
// Pattern: https://cc.bruniaux.com/guide/ultimate-guide/{chapter-slug}/#{section-anchor}
|
||||
const CHAPTER_RANGES: Array<{ from: number; to: number; slug: string }> = [
|
||||
{ from: 1, to: 220, slug: '00-introduction' },
|
||||
{ from: 221, to: 1378, slug: '01-quick-start' },
|
||||
{ from: 1379, to: 4231, slug: '02-core-workflow' },
|
||||
{ from: 4232, to: 5648, slug: '03-memory-files' },
|
||||
{ from: 5649, to: 6361, slug: '04-agents' },
|
||||
{ from: 6362, to: 7470, slug: '05-skills' },
|
||||
{ from: 7471, to: 8106, slug: '06-commands' },
|
||||
{ from: 8107, to: 9482, slug: '07-hooks' },
|
||||
{ from: 9483, to: 12118, slug: '08-mcp' },
|
||||
{ from: 12119, to: 19831, slug: '09-advanced-patterns' },
|
||||
{ from: 19832, to: 20760, slug: '10-reference' },
|
||||
{ from: 20761, to: 21384, slug: '11-ai-ecosystem' },
|
||||
{ from: 21385, to: Infinity, slug: '12-appendices' },
|
||||
];
|
||||
|
||||
function lineToChapterSlug(line: number): string {
|
||||
for (const range of CHAPTER_RANGES) {
|
||||
if (line >= range.from && line <= range.to) return range.slug;
|
||||
}
|
||||
return '12-appendices';
|
||||
}
|
||||
|
||||
export function githubUrl(filePath: string, line?: number): string {
|
||||
const base = `${GITHUB_BASE}/${filePath}`;
|
||||
return line ? `${base}#L${line}` : base;
|
||||
}
|
||||
|
||||
// Only ultimate-guide.md is rendered on the guide site
|
||||
// Only ultimate-guide.md is rendered as multi-chapter on the guide site
|
||||
export function guideSiteUrl(filePath: string, line?: number): string | null {
|
||||
if (filePath !== 'guide/ultimate-guide.md') return null;
|
||||
// Line numbers don't map to anchors directly — link to the reader root
|
||||
// If a line is provided, append a hint as a hash comment (not a real anchor)
|
||||
return line ? `${GUIDE_SITE_BASE}/#L${line}` : GUIDE_SITE_BASE;
|
||||
if (!line) return `${GUIDE_SITE_BASE}/`;
|
||||
const chapterSlug = lineToChapterSlug(line);
|
||||
return `${GUIDE_SITE_BASE}/${chapterSlug}/`;
|
||||
}
|
||||
|
||||
export function formatLinks(filePath: string, line?: number): string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue