dotnet build CognitiveMesh.sln
dotnet test CognitiveMesh.sln --no-build
dotnet test tests/AgencyLayer/Orchestration/Orchestration.Tests.csproj # MAKER benchmark testsBuild treats warnings as errors (TreatWarningsAsErrors=true in Directory.Build.props). XML doc comments are required on public types (CS1591).
Five-layer hexagonal architecture. Each layer has its own sub-projects with separate .csproj files:
- FoundationLayer — Persistence (CosmosDB, Blob, DuckDB, Qdrant vector DB), security, notifications, circuit breaker
- ReasoningLayer — ConclAIve reasoning engine (Debate, Sequential, StrategicSimulation), ethical reasoning (Brandom + Floridi), threat intel, value generation
- MetacognitiveLayer — HybridMemoryStore (Redis + DuckDB), ReasoningTransparency, ContinuousLearning, SessionManager, performance monitoring
- AgencyLayer — MultiAgentOrchestrationEngine, DurableWorkflowEngine, checkpointing, MAKER benchmark, ActionPlanner, TaskRouter
- BusinessApplications — GDPR/EU AI Act compliance, decision support, customer intelligence
Dependency direction: Foundation ← Reasoning ← Metacognitive ← Agency ← Business. Never create circular references between layers.
- Hexagonal architecture: Ports (interfaces) in each layer, Adapters implement them. Engines contain pure business logic.
- Port naming:
I{Concept}Port(e.g.,IMultiAgentOrchestrationPort) - Adapter naming:
{Implementation}Adapter(e.g.,CosmosDbAdapter,InProcessAgentRuntimeAdapter) - Engine naming:
{Concept}Engine(e.g.,DurableWorkflowEngine,DebateReasoningEngine) - Event-driven: Wolverine
IMessageBusfor pub/sub in ActionPlanning. MediatR in some sub-projects. - Async everywhere: All public methods are async with
CancellationTokenparameter.
- .NET 9, C# preview, nullable reference types enabled
- PascalCase for public members,
_camelCasefor private fields - Constructor injection with null guards (
?? throw new ArgumentNullException) ILogger<T>for structured logging on all classes- Test framework: xUnit + Moq + FluentAssertions
- Test naming:
MethodName_Scenario_ExpectedResult
src/AgencyLayer/Orchestration/Execution/DurableWorkflowEngine.cs— Core workflow engine with checkpointing, retry, crash recoverysrc/AgencyLayer/Orchestration/Benchmarks/MakerBenchmark.cs— MAKER benchmark (Tower of Hanoi)src/AgencyLayer/MultiAgentOrchestration/Engines/MultiAgentOrchestrationEngine.cs— Multi-agent coordination with ethical checkssrc/MetacognitiveLayer/Protocols/Common/Memory/HybridMemoryStore.cs— Dual-write Redis+DuckDB memorysrc/ReasoningLayer/StructuredReasoning/— ConclAIve reasoning recipes
- Do not add
usingdirectives for namespaces already covered by<ImplicitUsings>enable</ImplicitUsings> - Do not reference AgencyLayer from MetacognitiveLayer (circular dependency)
- Do not modify
Directory.Build.propswithout explicit request - Do not store secrets in code — use environment variables or Azure Key Vault references
- Do not suppress CS1591 warnings globally — add XML docs to public types instead
Never mix strategic design decisions and code implementation in the same conversation. Use the orchestrator agent (/orchestrate) for architecture and planning, then delegate to team agents (/team-foundation, /team-agency, etc.) for implementation. Architectural decisions made during coding get lost when context shortens.
The interface can show one thing while something else happened underneath. After any significant operation:
- Check
git logto confirm commits actually landed - Check
git diffto confirm the change matches intent - Check build output for silent warnings that got swallowed
- If using multiple models, verify which model produced which output
When something doesn't work, don't ask "why doesn't this work?" Instead:
- Ask the agent to trace execution step by step
- Ask it to explain what each part of the code is doing
- Ask it to list its assumptions
- Unnecessary complexity becomes visible when forced to narrate
The protect-sensitive.sh hook blocks writes to secrets and credentials. Additionally:
- The following destructive commands are blocked by
guard-destructive-bash.sh(hook) andsettings.json(deny list):git push --force/git push -f(force-push)git reset --hardgit clean -f/git clean -df/git clean -fdgit checkout -- ./git checkout .git restore .git branch -D(force-delete branch)
rm -rfbeyond the project root is blocked by bothguard-destructive-bash.shandsettings.json- Package publishing (
dotnet nuget push) is denied insettings.json - If an operation cannot be undone, stop and ask for confirmation
"Connected" does not mean "working." For every integration point, verify:
- What can the agent see? (file access, API access, tool availability)
- What can't it see? (secrets, external services, runtime state)
- What is it allowed to do? (check
settings.jsonpermissions) - How is it tested? (unit tests, integration tests, manual verification)
- What counts as failure? (silent errors are the most dangerous)
Never jump straight to implementation. The sequence is:
- Understand the project context (
/discoverfor new codebases) - Define the plan and identify risks (
/orchestrateor TodoWrite) - Document architectural decisions in files (not just in chat)
- Only then start building
Speeding up the wrong decision just gets you to the problem faster.
Chat context gets summarized and shortened. Important decisions must be saved to durable storage:
- Architectural decisions → CLAUDE.md or dedicated ADR files
- Task state → TodoWrite tool or
.claude/state/files - Integration results → commit to the repo
- One orchestrator chat delegates; results return as files, not conversation fragments
The model's context is not version control. If a working solution exists only in chat, it can be lost on the next context window shift.
- Commit after each meaningful change, not at the end of a session
- Don't keep important code only in conversation
- Use descriptive commit messages that capture the "why"
- The
stop-build-check.shhook verifies the build on every response — treat build failures as blockers