cognithor
CLAUDE.md158 starsChanged 7 months agoApache-2.0View on GitHub
Context for AI coding assistants (Claude Code, Cursor, Codex, etc.) working in this repository. Cognithor · Agent OS — local-first autonomous agent operating system. Python backend (FastAPI gateway, PGE-Trinity orchestration; default backend is Ollama-served qwen3 models, with vLLM, OpenAI, Anthropic, Gemini and ~15 other backends as opt-in alternatives; 141 MCP tools across 30 modules — auto-generated into docs/integrations/catalog.json on every release) + Flutter Command Center (~200 Dart files, 60+ screens spread across feature areas + a Config sub-tree, 27 providers,…
- Installs packages
- Commits and pushes
In this repository5 other files it gives its agents.
- backupSkill
- gmail-syncSkill
- testSkill
- test-skillSkill
- wetter-abfrageSkill
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
After all feature PRs for a version: Direct-Commit on main bumps pyproject.toml + src/cognithor/__init__.py + flutter_app/pubspec.yaml + …
- Very specific: line 54
Update README.md "What's New" + roll CHANGELOG.md [Unreleased] → [X.Y.Z].
- Very specific: line 79
When the user says "weiter", read ~/.claude/projects/D--Jarvis/memory/MEMORY.md for the live state of in-progress releases.
- Distinctive: line 80
Don't add fallback / legacy / "for backwards compat" code unless explicitly asked.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Context for AI coding assistants (Claude Code, Cursor, Codex, etc.) working in this repository.
What this is
Cognithor · Agent OS — local-first autonomous agent operating system. Python backend (FastAPI gateway, PGE-Trinity orchestration; default backend is Ollama-served qwen3 models, with vLLM, OpenAI, Anthropic, Gemini and ~15 other backends as opt-in alternatives; 141 MCP tools across 30 modules — auto-generated into docs/integrations/catalog.json on every release) + Flutter Command Center (~200 Dart files, 60+ screens spread across feature areas + a Config sub-tree, 27 providers, 4 locales).
Owner: Alexander Söllner. License: Apache 2.0. PyPI: pip install cognithor. Current release: see pyproject.toml ([project] version).
Source layout
| Path | What lives here |
src/cognithor/ | Python source. 43 subpackages. Foundational: core/, mcp/, channels/, crew/, gateway/, memory/, security/, skills/. |
tests/ | Pytest, 17 000+ test functions across 868+ files, asyncio_mode=auto. Mirror-structure under tests/test_<package>/. Authoritative count: pytest --collect-only -q tests/ | tail -5. |
flutter_app/ | Flutter Command Center, package name cognithor_ui. UI lib at lib/, tests at test/, integration at integration_test/. |
docs/ | Architecture, ADRs, API reference, superpowers specs+plans. |
scripts/ | Bootstrapping + maintenance utilities (preflight_check.py, bootstrap_windows.py, etc.). |
cognithor_bench/ | In-monorepo benchmark scaffold with own pyproject.toml. |
examples/ | Reference impls (insurance-agent-pack/) + tutorial (quickstart/). |
Architecture in one paragraph
User input enters via a channel (CLI / Telegram / WebUI / 14+ others) → gateway routes to PGE-Trinity (Planner formulates a plan, Gatekeeper classifies risk GREEN/YELLOW/ORANGE/RED, Executor runs the steps). All three are qwen3 models served by Ollama by default (vLLM is an opt-in alternative for NVIDIA GPUs). Persistence: 6-tier memory (memory/), HMAC-SHA-256 hash-chained audit JSONL (hashline/), optional Postgres (db/). Live observability: crew.trace_bus.TraceBus → REST /api/crew/* + WebSocket crew_*_subscribe frames → Flutter Trace-UI screen. Skills, Agent Packs, and MCP tools are dynamically loaded. Operator-driven batch work runs through CRWE (cognithor.core.workflow.WorkflowRunner + cognithor task <manifest> CLI, v0.99.0): JSONL streaming, atomic checkpoint, file-locking, SIGINT/SIGTERM emergency-checkpoint, audit-chain integration. Six append-only ledgers (Provenance, Permission-Scopes, Tool-Fingerprints, Cloud-Escalation, Cost in micro-USD, Migration) plus signed run-receipts ship operational-trust guarantees end-to-end (TRUST-1..10).
Critical conventions
- Never run
git add -A/git add .— always stage exact paths. The repo has long-running pre-existing dirty state underskills/(auto-regen artefacts, seegit diffcarefully — frontmatter strips look destructive, do NOT commit them) anddocs/integrations/catalog.json(timestamp-only regen, harmless to drop). - Never chain
git push+gh pr merge+ branch cleanup in one command — Python's HTTPError swallows exit codes; a failed merge then deletes the branch. Always: merge in one turn, cleanup in the next. - Always run
ruff formatbefore commit — CI has a separateruff format --checkstep; lint-only passes mask format drift. from __future__ import annotations+ FastAPI: types in endpoint signatures must be module-level importable, NOT forward-string-only.- Owner-gated APIs: gate with
cognithor.security.owner.require_owner(user_id); readsCOGNITHOR_OWNER_USER_IDenv var. - Coverage gate:
--cov-fail-under=89in CI's full-regression step. - Win-py3.12 historically flaky:
time.time()resolution ~16ms on Windows; tests asserting strict ordering on back-to-back records need explicit insertion-seq tie-break.
How to test
| What | Command |
| Full backend regression | pytest tests/ -x -q (~13 min, 17 000+ test functions at v0.99.0; live count via pytest --collect-only -q tests/ | tail -5) |
| One backend module | pytest tests/test_<pkg>/ -v |
| Flutter unit tests | cd flutter_app && flutter test test/ (~3s, 48 tests) |
| Flutter analyze | cd flutter_app && flutter analyze |
| Flutter format check | cd flutter_app && dart format --output=none --set-exit-if-changed lib/ test/ integration_test/ |
| Backend lint | ruff check src/cognithor/ tests/ |
| Backend format check | ruff format --check src/cognithor/ tests/ |
| Backend type check | mypy --strict src/cognithor/<file>.py (per-file; whole-tree may have legacy issues) |
Release flow (memorise)
- Feature work on
feat/<name>branches → PR to main → squash-merge. - After all feature PRs for a version: Direct-Commit on main bumps
pyproject.toml+src/cognithor/__init__.py+flutter_app/pubspec.yaml+flutter_app/lib/providers/connection_provider.dart(kFrontendVersion) — all 4 must match. - Update
README.md"What's New" + rollCHANGELOG.md[Unreleased]→[X.Y.Z]. git tag vX.Y.Z+git push origin vX.Y.Z.- Manually
gh workflow run publish.yml --ref vX.Y.Z— never auto-trigger from the tag push (loop-prevention, see v0.94.x lessons).
Tooling
- gh CLI:
/c/Program Files/GitHub CLI/gh.exe(Windows). Authed againstAlex8791-cyber/cognithor. - Ollama:
http://localhost:11434by default. Override viaOLLAMA_HOSTenv var. - User home:
%USERPROFILE%\.cognithor\(Windows) /~/.cognithor/(Linux/Mac).
Pointers
- Architecture overview:
docs/ARCHITECTURE.md. - ADRs:
docs/adr/(currently: ADR-0001 PGE-Trinity vs GroupChat). - Operational Trust + audit chain:
docs/operational_trust.mdanddocs/hashline-guard.md. - Pack registry signing (PACK-4):
docs/superpowers/specs/2026-05-05-pack4-registry-signing.md+ runbookdocs/runbooks/registry_key_rotation.md. - CRWE workflow runner:
src/cognithor/core/workflow.py+ CLI atsrc/cognithor/cli/task_cmd.py. - Spec & plan archive:
docs/superpowers/{specs,plans}/<YYYY-MM-DD-<name>>.md. - API reference:
docs/api/crew-traces.md(more endpoints to come). - Channel guide:
docs/CHANNELS_GUIDE.md.
House rules for AI assistants
- Plan before refactoring large files (
channels/config_routes.py6 600 LOC,gateway/gateway.py5 800 LOC). Don't split them in a single drive-by commit. - The Flutter test suite is thin (97 % screens, 89 % providers untested). Treat any new Flutter code as the only line of defence; write the test even if not requested.
- When the user says "weiter", read
~/.claude/projects/D--Jarvis/memory/MEMORY.mdfor the live state of in-progress releases. - Don't add fallback / legacy / "for backwards compat" code unless explicitly asked. Trust internal contracts. Validate at user-input + external-API boundaries only.
- Comments: only when WHY is non-obvious. Don't restate what the code does.
- Match existing conventions before introducing new ones (camelCase keys in ARB files,
_asyncioaliasing decision inwebui.py, etc.).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

