Observed since 20 Oct, 22:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Four small, dependency-free memory and safety patterns for LLM agents: scratchpad state, fuzzy recall, pre-compaction checkpointing, and permission boundaries.
Four small, dependency-free memory and safety patterns for LLM agents — no vector database, no framework lock-in. Companion library to the AgentCraft articles "Why Your AI Agent Forgets Things Mid-Task" and "How to Stop an Autonomous Agent From Doing Something Destructive".
pip install -e .
Facts that must never age out of a truncated context window, re-injected into every prompt.
from agent_memory_kit import ScratchpadState
state = ScratchpadState()
state.set_pref("timezone", "America/Edmonton")
state.record_decision("using SQLite, not Postgres — no ops overhead needed")
system_prompt = f"You are a coding assistant.\n\n{state.render()}"
For facts too numerous to keep resident. Starts crude (difflib over a flat
JSONL file, zero infra) on purpose — swap in real embeddings later by passing
a custom scorer, without changing call sites.
from agent_memory_kit import FuzzyRecall
memory = FuzzyRecall(path="memory.jsonl")
memory.remember("the deploy target changed to Cloudflare Pages")
memory.recall("what is the deploy target?", top_k=3)
If your framework auto-summarizes old turns, don't let it decide unsupervised what survives — extract load-bearing facts into Pattern 1's state first.
from agent_memory_kit import ScratchpadState, CompactionCheckpoint
state = ScratchpadState()
def extract(history):
# a cheap, targeted LLM call — not shown here
return {"decisions": ["switched to SQLite"]}
checkpoint = CompactionCheckpoint(state, extractor=extract)
checkpoint.before_compaction(conversation_history=history)
# now safe to let the framework summarize/drop the raw turns
Classifies actions by reversibility and enforces it in code the model can't talk its way around — not a prompt instruction it can forget.
from agent_memory_kit import ActionTier, PermissionBoundary
boundary = PermissionBoundary()
boundary.register("read_file", ActionTier.AUTONOMOUS, read_file_impl)
boundary.register("send_email", ActionTier.CONFIRM, send_email_impl)
boundary.register("transfer_funds", ActionTier.BLOCKED, transfer_funds_impl)
boundary.execute("send_email", {"to": "a@b.com", "body": "hi"}, get_human_approval=ask_user)
# unknown/unregistered actions default to CONFIRM, never AUTONOMOUS
Most production agents end up running most or all four at once — the first three for memory reliability, Pattern 4 for safety once the agent can act autonomously.
Being published to PyPI now. Not yet on a public GitHub repo — that's still a
checkpoint pending sign-off (see agentcraft-site/PLAN.md).
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.2.0 | 9 Sept 2026 | 1 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:6f139bab28bd3d5b312148bc2d09bdd7fc89d53e8b3f78f228886027b6feb248