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.
curl -O https://raw.githubusercontent.com/mocartlex-wq/cognitive-core/main/CLAUDE.mdgit clone --depth 1 https://github.com/mocartlex-wq/cognitive-coreWrote 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.
[](https://agentmods.dev/instructions/mocartlex-wq/cognitive-core/claude-md)<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.
<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>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.
| Model | Per session | Once 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 |
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 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— FastAPI9002— MinIO console5432— PostgreSQL6379— 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
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.
- 8d ago First seen · 296 lines · 4,131 tokens per session scan C 3fc44544b80a
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.
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.
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.
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).
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).
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.
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.