Show HN: CogniKernel; AI Coding with cross session and cross platform memory
CogniKernel provides persistent, structured project memory for AI coding agents like Claude Code and Codex by extracting decisions, constraints, and abandoned approaches from coding sessions. It uses an event-sourced store with lexical-primary retrieval and write-time consolidation to inject compact context blocks into future sessions, preventing redundant re-decisions. The system avoids LLMs in the loop by using two small fine-tuned encoder models (~130 MB ONNX each) running locally on CPU for
Analysis
TL;DR
- CogniKernel provides persistent, structured project memory for AI coding agents like Claude Code and Codex by extracting decisions, constraints, and abandoned approaches from coding sessions.
- It uses an event-sourced store with lexical-primary retrieval and write-time consolidation to inject compact context blocks into future sessions, preventing redundant re-decisions.
- The system avoids LLMs in the loop by using two small fine-tuned encoder models (~130 MB ONNX each) running locally on CPU for salience classification and supersession detection.
- Memory is keyed by project path, enabling cross-tool consistency between Claude Code and Codex within the same directory.
- The architecture includes a fail-open design ensuring session continuity even if optional model components are missing, degrading gracefully to lexical fallbacks.
Why It Matters
This addresses a critical pain point in AI-assisted coding: context fragmentation across sessions where agents repeatedly rediscover or contradict prior decisions. By implementing local, deterministic memory extraction without cloud dependencies or per-session token costs, CogniKernel offers a privacy-preserving, cost-efficient alternative to vector-database-based memory systems that rely on generative summarization. Its approach demonstrates how lightweight specialized models can outperform heavy LLM loops for specific classification tasks while maintaining reliability through fail-open engineering.
Technical Details
- Event-Sourced Architecture: Maintains an immutable log of typed memory events (DECISION, CONSTRAINT_HARD/SOFT, APPROACH_ABANDONED) rather than mutable state, enabling auditability and replayability of project evolution.
- Dual-Model Pipeline: Uses
salience_v2(SetFit classifier with bge-small backbone) to classify sentence relevance/type during session capture, andsupersession_xenc(cross-encoder) to detect when new information overrides existing entries via latest-wins consolidation. - Lexical-Primary Retrieval: Combines keyword-based search with dense embeddings from the encoder models, prioritizing exact matches before falling back to semantic similarity to ensure predictable recall behavior.
- AST Skeleton Injection: Projects abstract syntax tree structures into agent context windows instead of raw file contents, reducing read operations by 60-80% according to internal benchmarks while preserving structural understanding.
- MCP Tool Integration: Exposes four targeted commands (
recall,find_related,skeleton,get_session_state) for programmatic memory access within coding environments, supporting both interactive and scripted workflows.
Industry Insight
The tool's success highlights a strategic shift toward "local-first" AI memory solutions as enterprises prioritize data sovereignty and operational resilience against API failures or pricing volatility. Developers should consider integrating similar event-sourced pattern recognition into their agent frameworks rather than relying solely on embedding databases, particularly for domains requiring strict compliance (e.g., healthcare or finance code generation). Future iterations may expand beyond coding contexts to technical documentation or research note-taking systems where maintaining decision provenance becomes equally valuable.
Disclaimer: The above content is generated by AI and is for reference only.