CLEAR_
Context Layering & Engineering for Agentic Resources
CLEAR_

How CLEAR keeps an agent's memory honest.

Giving a coding agent a markdown memory is the easy part. Keeping that memory from going stale as the code moves on is the hard part, and it's the part most "memory" tools quietly skip. Here's the whole system, one slide at a time.

v1.0 · Apache-2.0Claude Code plugingithub.com/QBall-Inc/clear
1The problem why agents drift on long projects

On anything bigger than a weekend project, a coding agent loses the plot. It starts every session cold, re-derives decisions you already made, and (the worst one) confidently acts on guidance that stopped being true three commits ago. A memory that never forgets the wrong things isn't memory. It's a liability.

cold start
Session N+1 starts with nothing from session N. You re-explain the architecture every single morning.
re-derivation
The same decisions get rediscovered, and sometimes reversed, because nothing wrote them down.
stale guidance
Old patterns resurface after they've been superseded. A confidently wrong agent is worse than a forgetful one.
2A concept is a file typed markdown, bound to code

The unit of knowledge is one markdown file with structured frontmatter. The frontmatter is the machine-read contract. The body is the human detail. No database, no server, just diffable files in your repo that get reviewed in the same PR as the code. The related_files list binds a concept to the code it concerns, so the moment you touch a bound file, its concepts surface on their own.

.clear/knowledge/TD-014.mdtechnical-decision
---
id:            TD-014
title:         Cursor-based pagination for the public API
type:          technical-decision
status:        active
tags:          [api, pagination, performance]
related_files: [ src/api/list-handler.ts ]
description:   Offset broke on deep page loads; cursors are stable.
---
3Seven knowledge types closed set, on purpose

The type isn't a free-text tag. It's a closed, opinionated set, because a known type is what lets the system treat a decision differently from a process or a lesson. Code is the first domain, not the only one.

TD
Technical decision
"Adopt JWT over session cookies for the gateway." The call, and the alternatives weighed.
PAT
Architectural pattern
"Repository pattern wraps every data source." A reusable structure in the codebase.
LES
Lesson learned
"The MCP server dropped tools over 200, so paginate the registry." A pitfall found the hard way.
BR
Business rule
"Refunds are blocked after 90 days." A domain rule the software must honor.
IW
Institutional wiki
Reference knowledge sourced from a canonical doc: the RFC, the runbook, the spec.
PROC
Process
A recurring procedure: its trigger, frequency, and steps, like the release checklist.
SH
Stakeholder
A person, team, service, or vendor, and what it owns. "Auth service · owned by Platform."
+
Beyond code (roadmap)
People, organizations, and events as first-class primitives: the bridge past coding.
4The lifecycle the dimension OKF scopes out · animates on entry

This is the heart of it. Every concept carries a status, and that status is what keeps the graph fresh instead of letting it rot. When a newer decision lands, the old one gets superseded. When something just stops being true, it gets deprecated. Neither one is deleted. Both are surfaced as stale, so the agent is never silently handed dead guidance.

pending
captured, provisional, awaiting review
active
confirmed and in force, eligible to surface
superseded
replaced by a newer concept, link both ways
deprecated
no longer true, kept and surfaced as stale
archived
removed from surfacing, terminal
live · src/api/list-handler.tswatching
PAT
006
Repository pattern wraps every data source
↳ src/api/list-handler.ts
active
TD
009
Offset pagination for the public API
↳ src/api/list-handler.ts
active
↳ superseded by TD-014 · surfaced as stale
TD
014
Cursor-based pagination for the public API
↳ src/api/list-handler.ts
pending
Entering the slide replays this. Or hit ↻ replay, top-right.
5The loop that drives it plan → schedule → act → manage
.clear/ · project state & knowledge, on disk planphases scheduleworkpackages actbuild managehandoff knowledgegraph(filesystem)
  • plan : capture intent as phases CLEAR tracks across sessions.
  • schedule : break it into trackable workpackages.
  • act : build. Decisions & lessons get captured right here, bound to the files you touch.
  • act ⇄ graph : the live exchange. Capture writes knowledge in, the graph serves the right context back.
  • manage : session handoff. The loop moving forward is what supersedes & prunes the graph.
6Where OKF fits convergence, not a priority claim

In June 2026 Google open-sourced the Open Knowledge Format, a draft spec for typed, resource-bound, markdown-native knowledge. It validates the model CLEAR has been running since 2025. The honest read is three layers. OKF specifies a format. CKS adds the lifecycle. CLEAR is the engine that lives it.

Layer 1 · format
OKF · Google v0.1
Typed, described, tagged, resource-bound, cross-linked markdown. Status, supersession and pruning are explicitly out of scope.
Layer 2 · + lifecycle
CKS · the CLEAR spec
Format parity, plus opinionated types and the full lifecycle: status, supersession, deprecation surfacing, pruning, provenance.
Layer 3 · the engine
CLEAR · shipped 2025
Captures while you build, serves the right context at the right time, syncs knowledge to project state. The system that runs the spec.
The graph gives you the structure to traverse. The lifecycle keeps it true. Building the software is what maintains both.
two commands · mirrors the standard Claude Code plugin flow

Ready to install?_

CLEAR installs via npm or the QBall-Inc plugin marketplace. Pick one, restart your session, and run the guided setup.

install the plugin
# Option A — npm
claude /plugin install npm:@qball-inc/clear

# Option B — marketplace
claude /plugin marketplace add QBall-Inc/plugins-market
claude /plugin install clear@qball-inc
then, guided setup
# restart, then
/cf-init
Get it here → github.com/QBall-Inc/clear Apache-2.0 coding agents first, ported next. Issues & PRs welcome