Working with Memory

Working with Memory

Pensieve’s memory system is what separates it from a generic AI writing tool. Instead of treating each article as an isolated request, Pensieve builds up a persistent understanding of who you are, what you care about, and what you have already written. Every agent draws on this context when it works.

Memory is stored as plain Markdown files — you can read, edit, and version them directly.


The Three Memory Layers

Layer Location What it stores
Identity & Style workspaces/<workspace>/identity/ Your voice, style guide, and author bio — shared across all projects
Topics of Interest workspaces/<workspace>/topics/ Notes, summaries, and cross-references for recurring topics
Project Artifacts workspaces/<workspace>/projects/<project>/ All pipeline outputs for a single project

Layers 1 and 2 are injected into every agent prompt (up to the configured token limits). Layer 3 is accessed by agents via tools.


Layer 1 — Identity & Style

Files

File Purpose
voice.md Describes your writing voice — tone, register, style tendencies
style_guide.md Explicit style rules — formatting preferences, grammar conventions, things to avoid
author_bio.md A short bio that agents can reference for context and attribution

Editing Identity Files

  1. In the Pensieve frontend, select your workspace and click Memory.
  2. Open the Identity tab.
  3. Click any file to open the editor.

Changes are saved immediately and picked up by the next pipeline run.

Writing a Good Voice Document

The more specific and concrete your voice.md, the more precisely agents can match your style. Compare these two examples:

Vague:

I write about technology in a casual way.

Specific:

I write long-form technical articles aimed at mid-level engineers.
My tone is direct and confident but not condescending.
I use "you" to address the reader and avoid the royal "we".
I prefer active voice. Sentences are short to medium length.
I use concrete code examples rather than abstract descriptions.
I avoid marketing language ("powerful", "robust", "seamless") and hedging ("it could be argued that").
I signal uncertainty honestly: "I'm not sure", "this is my interpretation", "verify this yourself".

Writing a Style Guide

Use style_guide.md for mechanical rules that should be applied consistently:

## Headings
- Use sentence case for all headings (not Title Case)
- H2 for main sections, H3 for subsections, no H4

## Lists
- Use bullet lists for unordered items, numbered lists for sequences
- No trailing periods on list items unless they are full sentences

## Code
- Always specify the language in fenced code blocks
- Use backticks for inline code, file names, and command-line arguments

## Numbers
- Write out numbers one through nine; use digits for 10 and above
- Always use commas in numbers ≥ 1,000

Layer 2 — Topics of Interest

Topics are the long-term memory of your writing practice. Each topic file represents a subject you write about repeatedly. As you complete projects, Pensieve automatically appends a summary and a cross-reference to the relevant topic files.

Topic File Format

Each topic is a single Markdown file named by slug (e.g., langchain-agents.md, rust-async.md):

---
title: LangChain Agents
last_updated: 2026-03-10T10:00:00Z
projects:
  - my-blog/langchain-tool-calling
  - my-blog/langgraph-intro
---

# LangChain Agents

LangChain agents use tool calling to take multi-step actions. The agent receives a list of tools as structured schemas, calls them by emitting JSON, and receives results back in the conversation. LangChain wraps this loop in an AgentExecutor or LCEL runnable.

## Key Concepts
- Tool binding: attaching tool schemas to a chat model
- Tool calling: the model emits a structured `tool_call` in its response
- Tool execution: the agent framework runs the function and returns the result
- Iteration: the loop continues until the model emits a final answer

## Prior Projects
- **my-blog/langchain-tool-calling** — introduced the basic tool calling loop
- **my-blog/langgraph-intro** — covered stateful multi-agent workflows

Creating Topic Files

  1. In the frontend, select your workspace and click Memory.
  2. Open the Topics tab.
  3. Click New Topic and enter the topic name.
  4. Write an initial summary — a paragraph or two is enough to start.

Automatic Topic Updates

After every completed pipeline, Pensieve reads the project’s artifacts and updates any topic files that are relevant to the article just written. It:

  1. Identifies which of your existing topic files are related to this project
  2. Appends a summary of the new project’s key findings
  3. Adds the project to the projects list in the frontmatter

This means that the second article you write on a topic will have richer agent context than the first — and the tenth will be even better.

Manual Topic Updates

You can edit topic files at any time. This is useful for:

  • Adding background knowledge you want agents to have before writing on a topic
  • Correcting or clarifying what was automatically appended
  • Adding links to external references
  • Removing outdated information

Token Limits and Summarization

Agents receive a slice of memory, not all of it. The workspace configuration sets token limits for each memory layer:

memory:
  max_identity_tokens: 2000      # max tokens from identity/ injected into prompts
  max_topic_tokens: 3000         # max tokens from topics/ injected into prompts
  max_stage_input_tokens: 6000   # max tokens from previous stage artifacts
  topic_summarize_threshold: 5000  # topic files larger than this are summarized first

When a topic file exceeds topic_summarize_threshold, Pensieve summarizes it before injecting it into the agent prompt. The full file is preserved on disk — only the injected version is shortened.

See Workspace Configuration for details.


Practical Tips

Start Simple

You don’t need perfect identity files before your first project. Start with a one-paragraph voice.md and refine it after you see the first draft. Real output gives you concrete things to react to.

Edit Artifacts as Feedback

When you read style_review.md and agree with its suggestions, update your style_guide.md to encode those rules permanently. Future projects will benefit from the rule without needing the review to catch it.

Use Topics as a Knowledge Base

Topic files don’t have to be built from projects alone. You can manually add notes from articles you’ve read, talks you’ve attended, or things you’ve learned. Pensieve agents treat these notes as first-class context when researching and drafting.

Multiple Workspaces for Different Contexts

If you write in very different registers — say, technical blog posts and creative fiction — use separate workspaces. Each workspace has its own identity, topic library, and configuration. Agents in one workspace never see the other’s data.


What’s Next