Show HN: A plain-text cognitive architecture for Claude Code
TL;DR Highlight
A project that designs a hierarchical memory structure (Cognitive Architecture) based on plain-text files to address Claude Code's inability to retain memory across sessions. A practical reference for developers who want to use AI coding assistants consistently over the long term.
Who Should Read
Developers who use AI coding assistants like Claude Code or Aider daily in their work, but are frustrated by having to re-explain context every time a new session starts.
Core Mechanics
- Claude Code has no memory between sessions by default — once a conversation ends, it retains no prior context. Cog is a project that addresses this by building an external memory system composed of plain-text files.
- Instead of dumping everything into a single file, memory is divided into tiers such as 'hot (load immediately) → warm (load on demand) → cold (archive)'. This allows efficient use of the context window and enables fast access to frequently needed information.
- A dedicated 'onboarding flow' at session start and a 'shutdown flow' at session end are built in, so the AI can organize and update its own memory autonomously — similar to how a person checks their TODO list at the start of the day and writes a journal at the end.
- One of the core design philosophies of this project is that storing context-rich lessons (e.g., 'Do not mock the DB in integration tests — there was a case where tests passed but the migration failed') is far more effective than storing bare facts (e.g., 'The database is PostgreSQL 16').
- The project is similar to CLAUDE.md (the per-project instruction file officially supported by Claude Code), but adds a more sophisticated structure. Architectural decisions, file paths, and rules like 'do X / don't do Y' are systematically organized to guide Claude toward consistent behavior.
- This approach is not limited to Claude Code — it is a general-purpose pattern that applies equally to other AI coding tools such as Aider and OpenCode. Being plain-text based makes it compatible with any tool.
- Alternatives like Anthropic's official Auto Dream feature or episodic-memory exist, but Cog's differentiator is that developers can directly customize the structure and version-control the files with git.
Evidence
- "A comment pointed out reliability issues with long-term memory — if observations from 30 sessions ago and inferences drawn from a single offhand remark are stored at the same level, the memory becomes increasingly useless. A real implementation experience was shared where tagging entries with confidence scores and timestamps, decaying memories that hadn't been reinforced over time, and managing conflicting observations in a separate 'contradictions log' proved to be useful. There was also a pragmatic counterargument that a well-written CLAUDE.md alone is sufficient. A developer who heavily uses Claude Code for infrastructure work argued that 'storing lessons was far more effective than storing facts,' and that a single well-crafted CLAUDE.md can be more powerful than a complex memory architecture. A case was shared of someone implementing a far more sophisticated workflow on their own — managing separate onboarding.md, journal.md, and musings.md files, and having the AI review consistency across all documents and code before submitting a PR at the end of each session. The view was that 'treating AI as a collaborator rather than a tool yields much better results,' though the author honestly noted the significant downside of massive token consumption ('token fire'). Some expressed that Codex handles context management better than Claude, sharing a comparison experience that 'Claude drops information from its context, whereas Codex doesn't forget content even in long sessions' — which ironically validates the very reason this project exists to work around Claude Code's fundamental limitations. There was also a critical perspective that this entire approach is a superficial fix that patches LLM architectural limitations with text files. The argument was that if local open models were more competitive, this would have been solved with overnight fine-tuning — a philosophical critique pointing to the inherent limitations of the current LLM paradigm."
How to Apply
- "If you find yourself repeating the same explanations at the start of every Claude Code session, write lessons in your CLAUDE.md in the format 'don't do X + the reason why (including failure cases)' instead of plain facts. For example, including context like 'No DB mocking in integration tests — there was a past case where tests passed but the actual migration failed' will make Claude behave far more consistently. Managing all memory in a single file wastes your context window. Split files into three tiers — 'always-load (core project principles)', 'load-when-needed (per-module rules)', and 'archive (history of past decisions)' — and instruct Claude to read only the relevant files at session start to improve token efficiency. If you're concerned about the reliability of AI memory in long-running projects, get into the habit of annotating stored information with 'when it was recorded' and 'how certain it is (speculation vs. verified fact)'. When conflicting information arises, don't delete either entry — keep both in a 'conflict' section, which will help with context reconstruction later. The Cog architecture is not exclusive to Claude Code, so it applies equally if you use Aider or other AI coding tools. Check out the structure on the official Cog site (https://lab.puga.com.br/cog/) and try adopting it by simply adjusting the file conventions to fit your own tool."
Terminology
Related Papers
Show HN: adamsreview – better multi-agent PR reviews for Claude Code
Claude Code에서 최대 7개의 병렬 서브 에이전트가 각각 다른 관점으로 PR을 리뷰하고, 자동 수정까지 해주는 오픈소스 플러그인이다. 기존 /review나 CodeRabbit보다 실제 버그를 더 많이 잡는다고 주장하지만 커뮤니티에서는 복잡도와 실효성에 대한 회의론도 나왔다.
How Fast Does Claude, Acting as a User Space IP Stack, Respond to Pings?
Claude Code에게 IP 패킷을 직접 파싱하고 ICMP echo reply를 구성하도록 시켜서 실제로 ping에 응답하게 만든 실험으로, 'Markdown이 곧 코드이고 LLM이 프로세서'라는 아이디어를 네트워크 스택 수준까지 밀어붙인 재미있는 사례다.
Show HN: Git for AI Agents
AI 코딩 에이전트(Claude Code 등)가 수행한 모든 툴 호출을 자동으로 추적하고, 어떤 프롬프트가 어느 코드 줄을 작성했는지 blame까지 가능한 버전 관리 도구다.
Principles for agent-native CLIs
AI 에이전트가 CLI 도구를 더 잘 사용할 수 있도록 설계하는 원칙들을 정리한 글로, 에이전트가 CLI를 도구로 활용하는 빈도가 높아지면서 이 설계 방식이 실용적으로 중요해지고 있다.
Agent-harness-kit scaffolding for multi-agent workflows (MCP, provider-agnostic)
여러 AI 에이전트가 서로 역할을 나눠 협업할 수 있도록 조율하는 scaffolding 도구로, Vite처럼 설정 없이 빠르게 멀티 에이전트 파이프라인을 구성할 수 있다.
Show HN: Tilde.run – Agent sandbox with a transactional, versioned filesystem
AI 에이전트가 실제 프로덕션 데이터를 건드려도 롤백할 수 있는 격리된 샌드박스 환경을 제공하는 도구로, GitHub/S3/Google Drive를 하나의 버전 관리 파일시스템으로 묶어준다.