CogniKernel: Persistent Memory for your AI Coding Agents

AI coding agents are getting better at writing code, but there’s still a fundamental problem: they don’t reliably retain project knowledge across sessions.

Decisions get forgotten. Abandoned approaches resurface. Constraints established hours ago can disappear when a new session starts

I built CogniKernel to explore a different approach to this problem.

Instead of treating memory as another vector database wrapped around an LLM, CogniKernel uses an event-sourced architecture to maintain structured project memory across coding sessions. It captures decisions, constraints, changes, and superseded approaches so that useful context can survive beyond a single conversation.

A few engineering choices behind the project:

Local memory processing: Two fine-tuned encoder models exported to ONNX handle salience classification and supersession detection.

Event-sourced memory: Project knowledge is maintained as an evolving history rather than just a collection of retrieved text chunks.

No LLM in the memory-processing loop: The core classification pipeline uses compact models instead of requiring another generative-model call for every memory operation.

Cross-session continuity: The goal is to help coding agents retain the context needed to make better decisions over the life of a project.

I’m particularly interested in the systems side of agentic AI: how far can we push useful memory with compact models, deterministic infrastructure, and efficient inference instead of adding another large-model dependency?

This also raises interesting questions around latency, resource consumption, memory quality, and the trade-offs between compact encoder models and generative approaches.

CogniKernel is open source, and I’d love to hear how other developers are approaching persistent memory for AI agents.

Repository: GitHub - KanishkNoir/cognikernel: Persistent, structured project memory for Claude Code and Codex - event-sourced, typed, fail-open. Your agent stops re-deciding what you already decided. · GitHub

If you’re building AI agents, working on inference optimization, or experimenting with local models, I’d be interested in your thoughts on this architecture.

1 Like

Hello, thank you a lot for sharing your project with us. Just some notes from my side, your hooks.py comment points at the biggest systems win. Each Stop-hook drain starts a fresh Python process that spends about 20 s loading models before its first job, and that’s part of why the Stop hook now needs a 300 s timeout. One long-lived local worker that keeps the encoders loaded, with hooks only enqueueing, would remove that cold start. Batching would help too, since salience_v2 and the cross-encoder run one sentence or pair per session.run call. Hope this is helpful somehow.

1 Like

Hey, thanks Hakob. I’ve been postponing the next update to resolve this issue majorly. Your reply is really insightful and I would try our your suggestions!

1 Like