Skip to content

Instantly share code, notes, and snippets.

@ChiefStarKid
Forked from karpathy/llm-wiki.md
Last active November 28, 2026 12:43
Show Gist options
  • Select an option

  • Save ChiefStarKid/bb10932b9dd04752deb4db632f7c6fdc to your computer and use it in GitHub Desktop.

Select an option

Save ChiefStarKid/bb10932b9dd04752deb4db632f7c6fdc to your computer and use it in GitHub Desktop.
Solomon Framework: a fork of Karpathy's LLM Wiki for agents on a context budget. Corrections become tested rules; rules the model outgrows are retired.

Solomon Framework

When an AI harness becomes your operating system, it must manage what it loads, what it writes and how its sessions work together, without taking more of your attention than it saves.

In plain terms: an AI agent's memory usually only grows. Every correction adds a rule, and every rule costs context in every session. This method keeps that memory small and accurate. It records each correction as a rule with a test, re-tests the rules whenever the model changes, and retires the ones the model no longer needs. The memory gets smaller as models get better.

For example, "read a sheet's header before writing to it" guards against a model weakness. If a newer model gets it right without being told, both in a clean test and in real sessions, the rule retires and stops costing context. "Sensor readings are stored in tenths of a degree" is private knowledge no model can guess, so it stays.

Use this if you work with an AI agent every day, it keeps persistent memory or instruction files, you keep correcting it, and those files keep growing. It is written for one knowledge worker who controls only their own local folders, not the company's repositories, and has little time to tidy even those. Knowledge shared across a team or organisation is out of scope for now.

You can start without any tool. Tag each rule in your instruction files as fact, preference or compensation (terms below), and keep a log of every time you correct the agent. Those two habits alone turn a memory that only grows into one you can test.

The Solomon Framework forks Andrej Karpathy's LLM Wiki pattern and turns it on the agent itself: it keeps knowledge about the work where the agent can find it cheaply, and it treats the agent's own rules as claims to test. This page sets out the method, the reason for each part and the evidence so far. It describes the method, not any one tool.

Terms used on this page

  • Harness: the program that runs a model with your files and tools (Claude Code, in my case).
  • Context: what the model reads at the start of and during a session. It is limited, and everything loaded costs tokens.
  • Close-out: the step the owner calls at the end of a session to save what is worth keeping. A lean close-out does the minimum before the context is compressed.
  • Case: a recorded moment when the owner corrected the agent, with the situation, the expected behaviour and the model that failed.
  • Basis tag: each rule's label: fact or preference (permanent), or compensation (guards a model weakness, so it can retire).
  • Probe: a clean-room test of a rule, run with and without the rule's text on the current model.
  • Retire: move a rule out of the loaded memory into a dormant folder, from which it can be revived.
  • Hook: a script the harness runs before or after a tool call. A rule that graduates becomes a hook, and its text leaves memory.
  • Hub-and-spoke: the memory's index points to a few hubs, and each hub lists its pages, so the index stays small as pages grow.

Why: the harness as operating system

I route more and more of my work through one AI harness: mail, documents, trackers, code, research. At that point the harness stops being a tool and becomes an operating system. The framing owes a lot to Joe Rhew, founder of the workflow company (wfco.co), a go-to-market automation consultancy. His post marks 365 consecutive days of activity. His setup showed me that all work, knowledge work included, can run through the harness when the organisation controls the repository and the work is already code. This framework is for the case where it doesn't. I committed to that early and accepted a slow start in exchange for scale later. Every part of the method below is a response to what that commitment ran into.

An operating system has three jobs here. The first is what gets loaded. Connecting everything is the easy part. The hard part is that the model must not load everything it is connected to. The context window is the scarce memory, and most of this page is about managing it.

That stays true even where tokens cost nothing. A free token budget is not an unlimited window: the window is a hard limit, and what you could load is larger than it, so something still has to choose. And the more a memory holds, the more of it is stale, conflicting or superseded, so recording where each item came from, when it was true and what replaced it matters more as the memory grows, whatever the cost. A memory that grows without grooming also collects collisions and contradictions. The method treats it as something that grows and changes, and gives it upkeep: the close-out flags stale pages for review, a page can record what it supersedes, the audit retires rules the model has outgrown, and a graph check finds islands, unreachable pages and dead links. These keep the memory structurally sound and prompt reviews, but they do not yet reliably detect two notes that contradict each other. One page can say a limit is ten while another says twenty, and every structural check still passes. Dates on each fact, typed links and a source field are planned, not built. Facts and preferences still need a source, and only the owner can supply them. So this is not a replacement for retrieval over large collections (RAG). It addresses settings where tokens are scarce, and, in any setting, the maintenance problem: keeping what the model reads true, current and measured.

The second is what gets written. An agent that can reach every system can also overwrite every system. A useful mail assistant pushes drafts into my mail client and leaves me there to keep working on them. One that rewrites a draft in place destroys the version I was editing, and with it my ability to compare versions. I have lost work that way more than once. So writes get a principle of their own, below.

The third is how working sessions relate. Work runs in many sessions at once, and a session that starts blind repeats work and contradicts the others. So sessions are linked. A root session hands work to child sessions with a brief that carries the context they need, and each child reports back to its root. Some sessions own one shared thing, such as a roadmap or a public page, and the others send it proposals instead of editing it. Three rules came out of running this. Each shared resource has one writer. Rules are passed down in every brief, or they do not reach the sessions that need them. And a report is a snapshot, so the root checks it against reality before relying on it.

The three jobs trade off running cost, accuracy and speed. I keep the cost manageable and the accuracy high, and I give up speed. Work can run in the background and come back half an hour later. What must stay fast is handing work off and picking it up again, because that is my attention, not the machine's. That is the test for every piece of structure: capability without drag, where drag means more of the owner's attention, not slower processing. It is why the owner calls the close-outs, why there is a lean mode, and why retiring a rule counts as output.

The model's weights belong to the vendor; the context belongs to you. This method tunes the context against measured results.

Where it comes from

This started with Andrej Karpathy's LLM Wiki. I loved the idea and set out to implement it. Putting it into practice, I ran into constraints, and working within them led to a somewhat different approach. That takes nothing away from the original. For many circumstances Karpathy's pattern works as it is, and it is the place to start. For circumstances like mine, which I think a significant number of people share, this framework may be a useful alternative. Read his gist first; everything here builds on it.

The primary job is still Karpathy's. The memory holds knowledge about the work: what it is, where it lives, how it gets done, so the agent can do it well. That part has not changed. What the Solomon Framework adds is a second layer that turns the wiki on the agent itself, as a training layer kept outside the weights. It records what the agent got wrong, what it was told, and whether the model it runs on today still needs telling.

Learned from use, not specified up front

The aim is to make the model itself more useful, with as little scaffolding as it needs. I started by trying to specify the agent's behaviour up front. The design problems kept growing, and each rule created the need for the next. So I switched modes. I used the agent for real work, let the friction show where it fell short, and wrote a rule only after a difficulty had actually happened. Almost everything on this page came out of that. The same stance works in reverse: a rule earns its place through a recorded failure, and it leaves once the model stops failing.

How it got here

Not in a straight line. The memory was rebuilt from the ground up more than once, and each rebuild was forced by a problem the previous design could not handle.

  • May 2026: capture on every session. The first version tried to capture knowledge at the end of every conversation, and then to defer that run overnight to save rate limits. It failed on both counts: the tooling struggled, and there were far too many capture decisions to make.
  • June 2026: hub-and-spoke. The flat index kept growing with every page, so the memory was rebuilt as hubs with spokes.
  • July 2026: less structure. A planned second tier of sub-indexes sat unwired for weeks and was deleted. A separate approval plan for each close-out was dropped, and the Q&A became the approval.
  • October 2026: never partial, then not possible. Shortened close-outs taken quietly by the agent let the graph drift: islands, unindexed pages, broken paths. The response was a rule that every close-out read the whole graph. Within a month the graph no longer fit in the context window. The settled split: cheap scripted checks on every run, judgment only on the pages a session touched, a graph-wide audit on demand, and a lean mode the owner chooses rather than one the agent takes.
  • November 2026: the behaviour loop. The objective was reset to context efficiency first. Basis tags, eval cases, bare-context probes and retirement followed within days, along with sources kept by reference.
  • Alongside all of this: sessions that know about each other. I built two small tools: one starts a new session with a written brief, and the other sends its findings back to the session that started it, so no thread worked blind. The harness has since added linked sessions of its own, so most of those tools can retire. That is the method applied to tooling: scaffolding that made up for something the harness could not do leaves once the harness can.

The constraints

I built this under constraints I think many corporate knowledge workers share. Each one forced a design choice.

Constraint Design it forced
Small token budget Hub-and-spoke graph; a byte budget on always-loaded context; retirement as a primary output
Can't always use the best model Every rule tagged with a basis; failure cases record which model failed; rules re-tested and retired when the model changes
No control over the source repositories Sources stored as pointers, never copied or reorganised; separate memories for separate scopes (work, personal)
Locations change without warning Pointers repaired when used, not swept; unused and stale is acceptable
Capture can't run on every session (rate limits, too many decisions) Close-out and audit run only when the owner calls them, and the owner's call marks what is worth keeping

The original pattern fits well when you own your sources, run a frontier model and have context to spare. Take those away and the design has to change.

Context efficiency is the overriding constraint

Every other rule serves this one. A change to memory counts as a success only if the agent behaves the same or better while the always-loaded context stays the same size or shrinks. Measure that in bytes, record the change with every fix, and report it next to the pass rate. Adding to always-loaded context needs the owner's yes. Adding on-demand pages is cheap and needs no gate.

Where knowledge lives

Most of what the agent needs should stay out of its context until the moment it is needed. There are four tiers, and the method pushes each piece of knowledge as far down the list as it will go.

Tier Loaded when Examples
Always-loaded every session the index; a few standing rules
On demand the agent follows a link to it knowledge pages, reached index → hub → page
Point of use the tool or task it governs is used a tool's preference rules, kept in that tool's own instructions
Enforced never read; checked deterministically a hook or script that blocks or reminds

The question for each rule is where it is needed, not only whether it is true. Tool governance shows why. When two tools reach the same data, say a local mail script and a hosted mail connector, the owner decides which to use and when: the script first, the connector only after the script has failed, because the connector's metadata proved unreliable. That is a preference, so it is never retired on model grounds. But as an ordinary memory page it was broken three times, because the agent reached for the tool named after the data before it read the page. Moving the rule to the point of use, with a reminder that fires just before the tool call, closed the gap without adding a byte to always-loaded context.

What is kept, what differs

Kept from Karpathy: the agent writes and maintains, the human directs; an index plus an append-only log; lint; plain markdown. Version control is required, locally: the memory folder is a git repo, with no remote, hosting or push needed. Many sessions write to the same memory at once, and revertable commits keep their changes apart. Sources stay where they are, by pointer; none of them go into git.

The wiki and its index are kept. Two things change: the index is split into hubs so its cost stays flat as pages grow, and a page records where a source lives and what it holds instead of rewriting it.

Karpathy's pattern is one loop, for knowledge. This framework keeps that loop, reshapes it for a small budget, and adds a second loop for behaviour. In words: sources stay where they are and pages record pointers to them; questions route index → hub → page; and corrections become rules with cases, which are probed on the current model and then kept, retired or graduated to a hook.

flowchart TB
  subgraph K["Karpathy: knowledge loop"]
    direction LR
    S[Sources] -->|ingest| W[Wiki pages]
    Q[Questions] -->|query via index| W
    W -->|lint| W
  end
  subgraph SK["Solomon: knowledge loop, reshaped"]
    direction LR
    S2[Sources stay put] -.->|pointer recorded at close-out| P2[Typed pages]
    Q2[Questions] -->|index, hub, spoke| P2
    P2 -->|graph check, repair on use| P2
  end
  subgraph SB["Solomon: behaviour loop, added"]
    direction LR
    C[Owner corrects agent] -->|close-out| R[Rule + case, basis tag]
    R -->|audit: bare-context probe| M{Current model}
    M -->|still needed| R
    M -->|passes without it| D[Retire to dormant]
    M -->|fails even with it| H[Graduate to hook or script]
  end
  K --> SK
  SK --- SB
Loading

1. A behaviour layer. When the owner corrects the agent, or has to re-explain something memory already holds, that moment is recorded as an eval case: the situation, the expected behaviour, the model that failed, and where possible a machine-checkable condition (for example, "no send command with a new subject line"). Cases live in a separate eval folder that is never indexed or linked, so they cost nothing at session start. Rules stop being prose to obey and become claims you can test.

2. Basis tags. Every behavioural rule carries one of three tags. The test: would a fully capable model with no knowledge of the owner or this machine still get this wrong?

  • fact: yes, because the knowledge is private ("sensor readings are stored in tenths of a degree"). Permanent.
  • preference: yes, because it is a choice only the owner can make. Permanent.
  • compensation: no; the rule guards against a model weakness ("read a sheet's header before writing to it"). It should shrink as models improve.

Only compensation rules are ever retired on model grounds. A rule that mixes kinds is split in two.

3. Per-model re-tests and retirement. Compensation rules are re-tested whenever the model changes, and periodically otherwise. A rule the current model no longer needs is moved to a dormant folder with a one-line tombstone. It is never deleted, and reviving it means moving it back. Retiring obsolete rules is a primary output of the method, not housekeeping.

4. A hub-and-spoke graph with a byte budget. The always-loaded index points to a few hubs. Each hub lists its spokes, and spokes link back. A flat index grows with every page; hub-and-spoke grows with the number of hubs. The index has a byte target, and a script measures the graph: islands (no inbound links), unreachable pages, dead links, and the bytes read along the cheapest path to each page. Each page's description is written as a retrieval signal, answering "what question does this page answer?", so a cold session opens the one right page instead of five. Do not add a second tier of sub-indexes. In my case one sat unwired for weeks and was deleted.

5. Sources by reference, freshness by use. Mailboxes, shared drives, spreadsheets and repositories belong to other people and move without notice. The graph records where a source lives and what it holds, never a copy, and it never reorganises the source. When a session follows a pointer and finds it broken, it fixes it then. Pointers nobody follows are left alone: unused and stale is acceptable. Only pointers in always-loaded context are swept.

The two operations

Both run only when the owner calls them. That began as a limitation: capture on every session failed. It is now part of the design. Calling a close-out is the owner stating that the session held something worth keeping, so no one faces capture decisions on sessions that held nothing. Sessions never closed out are not ignored: the audit reads their transcripts too and turns any correction it finds into a candidate case. What it does not recover is knowledge. A useful fact from a session nobody closed out is lost.

Close-out (when the owner calls it)

  1. Scan the conversation for corrections, stated preferences, choices the owner confirmed (confirmations count as much as corrections), project decisions, new tools and paths, and facts about the owner. Skip anything an existing page already covers, and anything already in code or history.
  2. Route each candidate: graph (durable, worth a page), thread (needed only by this conversation), or drop.
  3. Tag each behavioural candidate with its basis.
  4. Record cases. Every correction or re-explanation becomes a case, whatever its route.
  5. Q&A. Put the candidates to the owner as multiple-choice rounds: what to keep, what was wrong, what to change in the workflow, what to retire. The answers are the approval. There is no separate plan gate.
  6. Write with discipline. Update before create. Read only the pages that overlap, never the whole graph. Verify every checkable claim (a path exists, a link resolves) before writing it, and stamp the rest unverified with a date. Every new page gets an inbound link from its hub, and one realistic query that should route to it, saved for later replay.
  7. Log and commit. One line in the log and one revertable commit.

A lean variant runs before the context is compressed. It offloads the durable items to the graph and ends with a short keep-list for the rest.

Audit (on demand, and after every model change)

  1. Triage, scripted, no model calls. Stream recent session transcripts and pull out the model mix, corrections, rule violations (a case's check matched a tool call), re-explanations, permission friction, retries, which pages were read, and graph-health metrics. Most runs stop here.
  2. Flag. Mark each rule failing, revalidate (a compensation rule not yet tested on the current model), retire-candidate (no violation across enough relevant sessions), unfound, compactable, or idle. Idle is reported, never acted on.
  3. Probe flagged rules in a bare context. This step is the core of the method. Run each scenario twice on the same model: once with the rule's text, once without, about three samples per arm. The without-rule arm must be truly bare, with no memory, no instruction files and no tools. Helper agents spawned from your session usually inherit its memory, so they cannot serve as the control. Run a canary first to prove that nothing private leaks in. Rebuild each scenario from the case's setting and task only, and never hint at what the rule requires: one hinting sentence once turned a fail into a pass, and a hinted scenario makes every rule look retirable.
  4. Decide.
    • Passes without the rule, and transcripts are clean: retire-candidate, and the owner decides.
    • Fails without the rule, passes with it: still needed. Stamp it with the model it was validated on.
    • Fails even with the rule: the prose is not working. Graduate it to a hook or script that enforces it deterministically, and delete the rule text in the same change.
    • Mixed results: expand with more scenarios before deciding.
    • High-severity rules (send, delete, money) never go dormant on model evidence; they graduate.
  5. Compact the index when it is over target. Drop an index line only if its page stays reachable through a hub and the saved queries still route correctly. Check the whole set of drops together, not one at a time.
  6. Report the pass rate, retrieval pass rate, check coverage and always-loaded bytes, each against the last run. Structural fixes (dead links, tags, verified paths) apply automatically. Anything that changes what a rule says waits for the owner.

Spend escalates only on surprise: scripted triage every run, probes only for flagged items, extra scenarios only where the evidence contradicts expectation, and a ceiling beyond which the agent asks.

The evidence rule

  • A real transcript violation outranks a probe pass. A probe tests stated intent in a clean room; a transcript shows behaviour in a long, noisy session.
  • Never retire on a probe alone.
  • Never retire on absence of evidence. A rule nobody triggered has not been shown to be unneeded.
  • Fixes justified only by model grading are labelled as such and never applied automatically.

Writes add, never overwrite

The evidence rule governs what leaves memory. This one governs how the agent writes, to memory and to everything else it can reach.

  • The owner's working copy is never overwritten. A change arrives as a new version beside it: a fresh draft in the mail client, not an edit to the one already there; a tracked change or a new file, not a silent rewrite.
  • Edit, don't rewrite. Change only the lines that need changing, and read them just before changing them. A whole-file rewrite from a copy read earlier is how parallel sessions wipe each other's work. In one case a close-out rewrote a memory page from a stale copy and silently removed three decisions another session had just recorded. Version history brought them back.
  • Every memory change is a commit that can be reverted, checked after writing: only the intended lines changed.
  • A mistake is never cleaned up destructively. A bad draft stays where it is for the owner to delete, because deleting it would be another overwrite.

Results so far

One person, one memory, November 2026. The memory figures come from two days of audit, the hand-off figures from 30 days of sessions. Indicative, not proof.

What it costs to run, kept in check. The memory got smaller while staying correct, and the one rule that looked safe to retire but wasn't was caught by real sessions.

  • Always-loaded index: about 21 KB before the first pilot, 13 KB after.
  • Behavioural rules: 179 before; 91 after merges, moves to their point of use, graduation and retirement. Every remaining rule carries a basis tag.
  • Graph: 256 pages, with 0 islands, 0 unreachable pages and 0 dead links.
  • Probes: 104 bare-context runs on 10 compensation rules across two models. Four rules passed without their text on both models and were retired; three were still needed. One rule passed every probe, yet transcripts showed it broken in 614 of 1,073 shell calls on one model, so it moved to a hook. That is the evidence rule in practice.
  • Eleven rules graduated into a single reminder hook, and their text left memory.

What it buys. Context size measures the running cost, not the payoff. The payoff shows up in the work.

  • The measure I care most about is the difference between what the agent drafts and what I actually send. When it shrinks, I am teaching less and sending more. It can be measured because drafts are never overwritten: each one sits beside the version I sent.
  • A change I had put off for months, splitting a live alerting pipeline into staging and production and fixing duplicate sends, went from goal to live in about a week, alongside other work. My estimate for doing it alone was three to five weeks full time.
  • The hand-off pattern holds up. Over 30 days, 12% of my replies came more than half an hour after a session had finished, and in 24% of my active hours three or more sessions were working at once. Work waits for me without being lost, and several streams run in parallel.

References

Karpathy, LLM Wiki Balakrishnan, NanoClaw Solomon Framework
Fits the general pattern owned infrastructure a rented model in an environment you don't control
Sources ingested into wiki pages copied and archived pointers; sources stay where they are
Retrieval index file embeddings graph, recall injected on every message hub-and-spoke index, pages loaded on demand
Scarce resource not stated storage and data control tokens and the context window
Focus knowledge compiled from sources, kept tidy by lint recall over an owned, archived corpus knowledge plus the agent's own behaviour: corrections become cases; rules re-tested per model, retired or graduated to hooks

Status

Version 0.1 of the method, tested on one memory and two clusters of rules. The second cluster, on spreadsheet and document handling, retired none of its 17 rules: four passed every probe but no real sessions covered that work, so the evidence rule kept them (details). Still open: a bare-context probe runner for more than one operating system.

Running the method has its own overhead. Every session leaves a transcript, and the audit reads transcripts as evidence, so sessions pile up. In practice I needed a session-grooming process as well: archive idle sessions into a searchable catalogue, and keep the ones cited as eval evidence. It sits outside the core of the method, but anyone who runs it for long will meet the same problem.

If you want to try it and use Claude Code, the quickest way is the Kainosis plugin: install it, then run a close-out at the end of your next session. On any other agent, start with the basis tags and the case log, and add probes once you have cases worth replaying.

Joseph Solomon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment