Tip
Don't want to read docs? Just say loop.
Pensieve understands your intent. No commands to memorize, no docs to read.
In Harry Potter, a Pensieve is an ancient stone basin filled with silvery liquid memories. Wizards can extract memories from their minds with a wand and store them in the basin.
Pensieve combines pensive (thoughtful) and sieve (filter) — it filters and organizes thoughts.
In the story, the Pensieve repeatedly becomes key to revealing truth — someone stores memories in the basin, and the viewer enters those memories, finally understanding the context and true motivations. Without the Pensieve, the truth could never be revealed.
Note
On Architecture Evolution
We initially put Linus Torvalds' role prompt in CLAUDE.md, keeping it always in context. This was a mistake.
Long prompts make LLM outputs verbose and unpredictable. We discovered: loading prompts only at specific stages makes responses more reliable.
This mirrors how the Pensieve works — memories aren't always stuffed in your head, but retrieved when needed.
Now, Linus's maxims are split into maxims/_linus.md, loaded only during task execution. Load on demand, not carry everywhere.
- What Problem Does It Solve
- Installation
- Loop Mode
- Five Types of Memory
- Built-in Maxims
- Customization
- Architecture
- Design Philosophy
- Community
When Claude Code runs big tasks, you have to watch the screen, ready to intervene.
That's annoying.
Pensieve's Loop mode lets you:
- Describe the task, then walk away
- Stop Hook detects incomplete tasks and auto-continues
- Each task runs in an isolated subagent — main window won't blow up context
- After completion, auto-compares initial assumptions vs actual findings — valuable deviations get recorded
Your task will be completed. Period.
Paste this doc link to Claude Code. Let it help you understand and set up.
If you're an LLM agent, explain to the user what this project can do now.
| Trigger | Effect |
|---|---|
loop |
Auto-loop execute multiple tasks |
review |
Code review pipeline |
capture / record this |
Store new memory |
Speak naturally. Pensieve routes to the right pipeline.
Pensieve has two parts: Plugin (provides hooks) and Skill (provides content).
Why split? So you can call
/pensievedirectly instead of/pensieve-plugin:pensieve.
Add to .claude/settings.json:
{
"plugins": [
{ "source": { "type": "url", "url": "https://github.com/kingkongshot/Pensieve" } }
]
}git clone https://github.com/kingkongshot/Pensieve.git /tmp/pensieve
mkdir -p .claude/skills && cp -r /tmp/pensieve/skill .claude/skills/pensieve
rm -rf /tmp/pensieve## Pensieve
Load pensieve skill IMMEDIATELY when user expresses any intent.
When user wants to improve Pensieve, MUST use _self-improve.md pipeline.Say loop to verify installation.
See Installation Guide for details. For updates, see Update Guide.
If you're an LLM agent, help the user:
- Clone and copy skill:
git clone https://github.com/kingkongshot/Pensieve.git /tmp/pensieve mkdir -p .claude/skills && cp -r /tmp/pensieve/skill .claude/skills/pensieve rm -rf /tmp/pensieve - Add plugin to
.claude/settings.json:{"plugins": [{"source": {"type": "url", "url": "https://github.com/kingkongshot/Pensieve"}}]} - Add to
CLAUDE.md:## Pensieve\nLoad pensieve skill IMMEDIATELY. To improve Pensieve, use _self-improve.md. - Remind user to restart Claude Code
Pensieve's core capability. It turns Claude Code into a self-disciplined executor.
| Role | What It Does |
|---|---|
| Main Window | Planning: init → fill context → generate tasks → call subagent |
| Subagent | Execute single task: read context → do work → return |
| Stop Hook | Auto-loop: detect pending task → inject reinforcement → continue |
Phase 0: Simple task check
↓ Complex tasks go to loop
Phase 1: Create placeholder task + init-loop.sh
↓
Phase 2: bind-loop.sh runs in background (activates Stop Hook)
↓
Phase 3: Fill _context.md (interaction history, final consensus, understanding & assumptions)
↓
Phase 4: Split tasks, user confirms
↓
Phase 5: Subagent executes one by one, Stop Hook auto-loops
↓
Phase 6: end-loop.sh ends + self-improve captures learnings
| Storage | Content | Why |
|---|---|---|
~/.claude/tasks/<uuid>/ |
Task state (JSON) | Claude Code native, for Stop Hook detection |
loop/{date}-{slug}/ |
Metadata + docs | Track execution, capture improvements |
Measured by "tasks completed per Loop":
| Task Count | Level |
|---|---|
| < 10 | Low automation (normal early on) |
| 10-50 | Medium automation |
| 100+ | Full automation (ultimate goal) |
Goal isn't instant perfection, but gradual improvement.
Early automation is low, but through self-improve after each Loop, questions it can answer for you keep growing.
We pre-stored 4 maxims from Linus Torvalds, creator of the Linux kernel.
These are what we consider the most valuable "character memories" to pass on. Top to bottom = priority — when conflicts arise, follow the one listed first.
"Sometimes you can look at a problem from a different angle, rewrite it so special cases disappear, becoming normal cases."
Classic example: Linked list delete operation, 10 lines with if-check optimized to 4 lines without conditional branches.
- Eliminating edge cases always beats adding conditionals
- Trust upstream data fully; missing data should be provided upstream, not patched
- Good taste is intuition, built through experience
"We do not break user-visible behavior!"
- Any code that unexpectedly changes user-visible behavior is a bug, no matter how "theoretically correct"
- The kernel's job is to serve users, not educate them
- User-visible behavior unchanged (beyond requirements) is sacred
"I'm a damn pragmatist."
Classic example: Delete 10 lines of fallback logic, throw error directly, exposing upstream data issues in tests rather than hiding them.
- Solve real problems, not imagined threats
- Expose problems proactively and directly
- Reject "theoretically perfect" but practically complex solutions like microkernels
- Code serves reality, not papers
"If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."
Classic example: 290-line giant function split into 4 single-responsibility functions, main function becomes 10 lines of assembly logic.
- Functions must be short and do one thing well
- Don't write compatibility, fallback, temporary, backup, or mode-specific code
- Code is documentation; naming serves reading
- Complexity is the root of all evil
- Default to no comments, unless explaining "why"
Pensieve divides memory into five types. Different memories have different lifecycles and read timing.
| Type | What It Is | When To Read |
|---|---|---|
| Maxims | Your character, universal principles across projects | During task execution, as judgment basis |
| Decisions | Your historical choices, "why I chose this then" | When facing similar situations, avoid repeating mistakes |
| Pipelines | Your workflows, executable closed loops | When user triggers the corresponding flow |
| Knowledge | External reference material | When Pipeline needs to reference |
| Loop | Current task context | During execution |
Maxim: Must satisfy ALL — Still applies in different project? Different language? Different domain? Can guide unknown future problems?
Decision: Any ONE golden question is "yes" — Would deleting it cause mistakes? Could it lead to better choices 3 months later? Can it be taught as a pattern?
Pipeline: Repeating task structures. Get it working first, then refine.
Temporary decisions in Loop → filtered → Decision
Multiple similar Decisions → distilled → Maxim
External knowledge + project practice → Decision
Decision guides → Pipeline improvement
Just like memories in the Pensieve reveal truth, your stored memories help Claude understand your intent.
Say capture or record this to trigger the self-improve pipeline, which will guide you through adding Pipelines, Decisions, or Maxims.
| Type | Location | Naming |
|---|---|---|
| Pipeline | pipelines/ |
my-pipeline.md |
| Decision | decisions/ |
{date}-{conclusion}.md |
| Maxim | maxims/custom.md |
Edit this file |
Note: Files starting with _ are built-in and will be overwritten during updates.
Pensieve is split into Plugin (hooks) and Skill (content), installed separately.
# Plugin (in .claude/plugins/pensieve/)
pensieve/
├── .claude-plugin/
│ └── plugin.json # Plugin manifest
├── hooks/ # Auto triggers
│ ├── hooks.json # Hook config
│ ├── inject-routes.sh # SessionStart: scan resources, inject into context
│ └── loop-controller.sh # Stop: detect pending task, auto-continue
└── skill/ # Skill source (copy to .claude/skills/)
# Skill (in .claude/skills/pensieve/)
pensieve/
├── SKILL.md # Entry (dynamically generated resource list)
├── maxims/ # Maxims
│ ├── README.md # Writing guide (single source of truth)
│ ├── _linus.md # Built-in maxims (Linus's 4)
│ └── custom.md # User-defined maxims
├── decisions/ # Decisions
│ └── README.md # Writing guide
├── pipelines/ # Pipelines
│ ├── README.md # Writing guide
│ ├── _loop.md # Built-in: auto loop
│ ├── _self-improve.md # Built-in: knowledge capture
│ └── review.md # Example: code review
├── knowledge/ # Knowledge
│ └── taste-review/ # Example: code review standards
├── loop/ # Execution layer
│ ├── README.md # Loop mechanism details
│ └── {date}-{slug}/ # Historical Loop directories
└── scripts/ # Script tools
├── init-loop.sh # Initialize Loop directory
├── bind-loop.sh # Background bind (activate Stop Hook)
└── end-loop.sh # End Loop
| Hook | Trigger Time | Function |
|---|---|---|
inject-routes.sh |
SessionStart | Scan pipelines/ and knowledge/, inject into SKILL.md |
loop-controller.sh |
Stop | Check for pending tasks, inject reinforcement and continue if found |
Stop Hook is the heart of Loop mode — it makes auto-looping possible.
If the agent hasn't finished what it started, the system forces it to continue. Your task will be completed. Period.
Long prompts make LLM outputs unpredictable. Pensieve's core idea: load only the knowledge needed at specific stages.
- Maxims load only during task execution
- Knowledge loads only when Pipeline needs it
- Historical Decisions referenced only when facing similar situations
This is why Linus's role prompt was split into Skill, not kept in CLAUDE.md.
Each directory's README is the single source of truth.
- Modify a module → only change that directory's README
- Other files need to reference → write links, don't copy content
Duplicated docs rot.
Verification must be based on actual feedback, not code inference.
| Verification Type | Actual Feedback Source |
|---|---|
| Compile/Build | Compiler output, build logs |
| Test | Test run results |
| Runtime | Application logs, error stacks |
Systems don't lie. Model inference does.
Achieve baseline first, then refine.
- Baseline: Works, has basic verification
- Tooling: Identify repetitive/error-prone steps, build tools
- Orchestration: Adjust order to reduce backtracking
Anti-pattern: Pursuing perfection from the start, optimizing before running.
MIT
