agentleFS
Alex8791-cyberAlex8791-cyber/cognithor/CLAUDE.md

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

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
  1. Very specific:

    After all feature PRs for a version: Direct-Commit on main bumps pyproject.toml + src/cognithor/__init__.py + flutter_app/pubspec.yaml + …

    line 53
  2. Very specific:

    Update README.md "What's New" + roll CHANGELOG.md [Unreleased] → [X.Y.Z].

    line 54
  3. Very specific:

    When the user says "weiter", read ~/.claude/projects/D--Jarvis/memory/MEMORY.md for the live state of in-progress releases.

    line 79
  4. Distinctive:

    Don't add fallback / legacy / "for backwards compat" code unless explicitly asked.

    line 80

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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

PathWhat 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 under skills/ (auto-regen artefacts, see git diff carefully — frontmatter strips look destructive, do NOT commit them) and docs/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 format before commit — CI has a separate ruff format --check step; 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); reads COGNITHOR_OWNER_USER_ID env var.
  • Coverage gate: --cov-fail-under=89 in 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

WhatCommand
Full backend regressionpytest 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 modulepytest tests/test_<pkg>/ -v
Flutter unit testscd flutter_app && flutter test test/ (~3s, 48 tests)
Flutter analyzecd flutter_app && flutter analyze
Flutter format checkcd flutter_app && dart format --output=none --set-exit-if-changed lib/ test/ integration_test/
Backend lintruff check src/cognithor/ tests/
Backend format checkruff format --check src/cognithor/ tests/
Backend type checkmypy --strict src/cognithor/<file>.py (per-file; whole-tree may have legacy issues)

Release flow (memorise)

  1. Feature work on feat/<name> branches → PR to main → squash-merge.
  2. 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.
  3. Update README.md "What's New" + roll CHANGELOG.md [Unreleased] → [X.Y.Z].
  4. git tag vX.Y.Z + git push origin vX.Y.Z.
  5. 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 against Alex8791-cyber/cognithor.
  • Ollama: http://localhost:11434 by default. Override via OLLAMA_HOST env 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.md and docs/hashline-guard.md.
  • Pack registry signing (PACK-4): docs/superpowers/specs/2026-05-05-pack4-registry-signing.md + runbook docs/runbooks/registry_key_rotation.md.
  • CRWE workflow runner: src/cognithor/core/workflow.py + CLI at src/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.py 6 600 LOC, gateway/gateway.py 5 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.md for 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, _asyncio aliasing decision in webui.py, etc.).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.