cognitive-core: Instructions file for Claude Code

CLAUDE.md

cognitive-core CLAUDE.md is an instructions file for Claude Code from mocartlex-wq/cognitive-core. It costs 4,131 tokens per session, scanned C, original, MIT.

A set of Claude Code instructions for building, testing, running, and checking a multi-service application called Cognitive Core. It includes commands for Docker, the API, databases, storage, logs, health checks, and tests.

In plain words
What is it for?
Starting or rebuilding services, viewing logs, running all or selected tests, checking the API health endpoint, and following the project's memory-system architecture.
Why use it?
It gives the coding agent project-specific commands and rules instead of requiring it to guess how the system is operated.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; names the AskUserQuestion tool.

This is mocartlex-wq/cognitive-core's own configuration. It tells Claude Code how to work on cognitive-core itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cognitive-core configures →

Reuse

Borrowing it

Nothing to install: this file belongs to mocartlex-wq/cognitive-core. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/mocartlex-wq/cognitive-core/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/mocartlex-wq/cognitive-core

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cognitive-core CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/mocartlex-wq/cognitive-core/claude-md/github.svg)](https://agentmods.dev/instructions/mocartlex-wq/cognitive-core/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/mocartlex-wq/cognitive-core/claude-md"><img src="https://agentmods.dev/badge/instructions/mocartlex-wq/cognitive-core/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cognitive-core CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/mocartlex-wq/cognitive-core/claude-md"><img src="https://agentmods.dev/badge/instructions/mocartlex-wq/cognitive-core/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,131 This file is loaded in full into every session.
When invoked 4,131 The same file — it is already loaded in full.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04131 $0.04131
Opus 5 $0.02065 $0.02065
Sonnet 5 $0.00826 $0.00826
Haiku 4.5 $0.00413 $0.00413

Measured 8d ago against content hash 3fc44544b80a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade C, and why

cognitive-core CLAUDE.md scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Harvests environment variableshighData exfiltration

Enumerating or grepping the environment for keys collects credentials unrelated to what the mod says it does.

- **Subprocess `docker exec printenv POSTGRES_PASSWORD` (`scripts/cognitive-rooms.py:~98`) — документированный 3-й fallback** после `env` → `.env`. Срабатывает только когда первые два пусты. Это корректное поведение, не

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl http://localhost:9001/health
CLAUDE.md · 296 lines

How it starts

The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md — Cognitive Core

Build & Run

# Сборка и запуск всех сервисов
docker compose up -d --build

# Пересборка только API
docker compose up -d --build api

# Просмотр логов
docker logs cognitive_api --tail 50

# Прогнать все тесты (56 шт.)
docker exec cognitive_api python -m pytest tests/ -v

# Прогнать только юнит-тесты (без LLM/сети)
docker exec cognitive_api python -m pytest tests/test_sanitizer.py tests/test_embedder.py tests/test_models.py -v

# Прогнать только API-тесты
docker exec cognitive_api python -m pytest tests/test_api.py -v

# Проверить здоровье
curl http://localhost:9001/health

Порты:

  • 9001 — FastAPI
  • 9002 — MinIO console
  • 5432 — PostgreSQL
  • 6379 — Redis Stack

API ключи: key-design-001 (agent_designer), key-dev-001 (agent_developer)

Архитектура

5-слойная система памяти для AI-агентов:

L1 (raw_events)   → сырые события от агентов
L2 (daily_buffers) → дневная консолидация через LLM
L3 (master_knowledge + tools_registry) → эталонные знания и реестр инструментов
L4 (snapshots)     → полные/дельта-снапшоты в MinIO (S3)
L5 (audit_log)     → журнал всех операций

Operative workspace (OP): KNN-поиск по L3 + сессии в Redis. Первый запрос создаёт векторы → последующие идут через RediSearch.

Структура ключевых файлов

app/
├── main.py              # Точка входа, lifespan, middleware, роутеры
├── config.py            # Все настройки через pydantic-settings
├── worker.py            # Фоновый планировщик (daily/weekly/monthly циклы)
├── api/
│   ├── events.py        # POST /events — приём событий
│   ├── operative.py     # POST /operative/query, close, feedback
│   └── memory.py        # POST /memory/consolidate/daily|weekly, /memory/audit/monthly, snapshots, cleanup
├── db/
│   ├── postgres.py      # asyncpg pool + CREATE TABLES
│   ├── redis.py         # Redis клиент + get_redis_raw() для векторов
│   └── s3.py            # MinIO клиент
├── models/              # Pydantic-модели для всех запросов
├── security/
│   ├── auth.py          # X-API-Key проверка + rate limiting
│   ├── sanitizer.py     # Санитизация payload (SQL/XSS/JS/shell)
│   └── audit.py         # Запись в L5 аудит-лог
├── services/
│   ├── ingestor.py      # Сохранение в L1
│   ├── analyzer.py      # L1→L2 дневной анализ (LLM)
│   ├── consolidator.py  # L2→L3 недельная консолидация (LLM)
│   ├── curator.py       # L3 аудит (месячный), фильтрация, качество (LLM)
│   ├── operative.py     # OP: KNN поиск, сессии, фидбек
│   ├── embedder.py      # Эмбеддинги: OpenAI → Ollama → хеш-fallback
│   ├── llm_client.py    # Единый LLM-клиент с A/B-тестом и fallback-цепочкой
│   ├── prompts.py       # Мультиязычные промпты (8 языков)
│   ├── tools.py         # CRUD реестра инструментов
│   └── metrics.py       # Prometheus + JSON-логирование
├── sandbox/
│   └── index.html       # API-песочница (доступна по GET /)
└── cognitive-client/    # Python SDK для внешних агентов
    ├── pyproject.toml
    └── cognitive/
        ├── __init__.py
        └── client.py    # AsyncMemoryClient + MemoryClient

Read the full file on GitHub · 296 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 296 lines · 4,131 tokens per session scan C 3fc44544b80a

Subscribe to this mod's changes

cognitive-core CLAUDE.md is an instructions file published in the GitHub repository mocartlex-wq/cognitive-core (1 stars, last pushed 2d ago), licensed MIT. It adds 4,131 tokens to every session, about $0.0207 per session on Opus 5. A static security scan graded it C with 2 findings (harvests environment variables, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,737 tokens