Architectural Decisions Log
Document Title: Architectural Decisions Log Last Updated: 2026-01-26 Maintainer: KernelCore (System Architect)
AD-001: Supreme Technical Form (STF) Protocol
- Decision ID: AD-001
- Date: 2026-01-25 (Blockchain Record: Pending Future Implementation)
- Status: Proposed
- Title: Adoption of Supreme Technical Directive (STF) for AI Agents
- Context:
Interaction with AI agents in critical engineering environments is currently fragmented. Agents rely on provider-specific system prompts (Claude vs Gemini vs OpenAI), leading to inconsistent behavior, potential hallucinations, and violations of strict project constraints (e.g., suggesting
pipinstead ofnix). There is no unified "Constitution" that overrides provider defaults. - Decision:
Implement the STF (Supreme Technical Directive) as the sovereign source of truth for all agents.
- Structure: XML/Markdown schema defining
identity,core_directives,behavioral_constraints, anderror_prevention. - Priority: STF > Provider Prompt > User Prompt.
- Protocol: Strict adherence to "Nix-First" and "No Hallucination" policies.
- Structure: XML/Markdown schema defining
- Rationale:
- Safety: Prevents execution of arbitrary code or assumption of unverified APIs.
- Determinism: Standardizes agent behavior across different LLM providers.
- Hermeticity: Enforces the use of Nix for all environmental dependencies.
- Consequences:
- Positive: predictable responses, reduced error rate, strict environment compliance.
- Negative: Agents may refuse vague tasks, requiring more explicit user prompting.
- Alternatives Considered:
- Provider System Prompts (CLAUDE.md): Rejected due to lack of portability and weak enforcement.
- Runtime Wrappers: Rejected as they are reactive (post-generation) rather than preventive.
-
Tags:
governance,ai-safety,nix,protocol -
Proposer: KernelCore
- Reviewers: Architecture Team
- Approval Date: Pending
- Superseded By: N/A
- Related Documents:
adr/proposed/ADR-0012.md - Metrics: N/A (Protocol definition phase)
- Risks: Agents might become too rigid ("refusal to answer") if constraints are overly aggressive.
- Mitigation: Calibrated confidence markers and explicit override mechanisms.
- Trade-offs: Flexibility vs. Reliability. We choose Reliability.
- Implementation Notes: Requires parser implementation in the Agent Hub to inject STF context dynamically.
- Diagrams: N/A
AD-002: AI Assistant Hub & Ranking System
- Decision ID: AD-002
- Date: 2026-01-25
- Status: Proposed / In-Implementation
- Title: Centralized AI Assistant Hub for Observability and Ranking
- Context: As AI agents become more autonomous, "entropy" (unpredictability/creativity) increases. We need a mechanism to validate agent decisions, ensure they don't hallucinate features ("ghost features"), and maintain alignment with the codebase without stifling their utility.
- Decision:
Establish a dedicated
ai-assistant-hubservice acting as a middleware/supervisor.- Observability: Prometheus/Grafana for metric tracking (latency, decision confidence).
- Ranking API: A centralized scoring system for agent actions.
- Policy: Actions with score < 0.9 require human (Developer) approval.
- Feedback Loop: Store decision outcomes to retrain scoring models.
- Rationale:
- Governance: We cannot trust black-box models blindly for critical infrastructure.
- Integration: Ensures new features are actually integrated (Git hooks/CI checks) and not just "hallucinated".
- Fallback: Explicitly codifies the Developer as the ultimate fallback for low-confidence decisions.
- Consequences:
- Positive: High trust in automated actions, preventing system corruption.
- Negative: Operational overhead of running additional services (Python API, DBs).
- Alternatives Considered:
- Client-side filtering: Rejected because it lacks centralized logging and learning capabilities.
- Blind Trust: Rejected as unsafe for production systems.
-
Tags:
observability,python,nix,fastapi,mlflow -
Proposer: KernelCore
- Reviewers: Infra Team
- Approval Date: Pending
- Superseded By: N/A
- Related Documents:
~/arch/ai-assistant-hub/README.md,flake.nix - Metrics:
- Latency of decision ranking (< 50ms target).
- Rate of human intervention (aiming for < 10% over time).
- Risks:
- Bottleneck: The Ranking API could become a single point of failure.
- Mitigation: Fail-safe mode (default to "Request Approval" if API down).
- Trade-offs: Latency (extra API hop) vs. Safety.
- Implementation Notes: Implemented as a Nix Flake project. Uses
FastAPIfor the ranking endpoint andTimescaleDBfor persistence. - Diagrams: N/A
AD-003: Sovereign Knowledge Storage via ADR Ledger
- Decision ID: AD-003
- Date: 2026-01-25
- Status: Accepted
- Title: Git-based Architectural Decision Records (ADR)
- Context: Architectural knowledge is often lost in chat logs or proprietary tools (Notion/Confluence). AI agents need a structured, parseable, and "sovereign" source of truth to understand the why behind system designs.
- Decision:
Use a Git-based ADR system (
adr-ledger) with a strict JSON schema.- Tooling: Bash scripts (
scripts/adr) for CRUD operations. - Verification: CI validation of markdown frontmatter.
- Consumption: Agents consume this via RAG (Retrieval Augmented Generation).
- Tooling: Bash scripts (
- Rationale:
- Sovereignty: "Not your repo, not your knowledge."
- Parseability: Structured Markdown + YAML frontmatter is ideal for both humans and LLMs.
- Auditability: Git history provides a cryptographically verifiable timeline of decisions.
- Consequences:
- Positive: Knowledge base is portable, offline-accessible, and machine-readable.
- Negative: Higher friction to write docs compared to a Wiki.
- Alternatives Considered:
- Wikis: Rejected due to lack of versioning and machine-readability.
- Database: Rejected due to lack of human-readability.
-
Tags:
documentation,git,knowledge-management -
Proposer: KernelCore
- Reviewers: Self
- Approval Date: 2026-01-25
- Superseded By: N/A
- Related Documents:
ADR-0001 - Metrics: N/A
- Risks: documentation drift (code changes, docs don't).
- Mitigation:
adr-compliancechecks in CI pipeline.
- Mitigation:
- Trade-offs: Write-friction vs. Read-reliability.
- Implementation Notes: Fixed syntax errors in
scripts/adrto support nullglob for robust file handling. - Diagrams: N/A
AD-004: Dev Environment Integration & CEREBRO Full Implementation
- Decision ID: AD-004
- Date: 2026-01-26
- Status: Accepted
- Title: Integrated Dev Deployment & CEREBRO (~6k LOC)
- Context: Successful deployment and integration of core ecosystem components, highlighted by the full implementation of the CEREBRO Intelligence System.
- Decision:
Formal acknowledgement of the technical milestone achieving operational status for CEREBRO (Intelligence Core, Project Scanner, React Dashboard), Phantom, SecureLLM-Bridge, Neutron, and Sentinel in
dev. - Rationale:
- Validates the transition of the project to a professional career goal.
- Demonstrates full-stack capability (Python/FastAPI + React/Tailwind) and advanced AI (RAG/Hybrid Search).
- Consequences:
- Positive: Robust integrated platform with semantic search and intelligence gathering capabilities.
- Tags:
milestone,deployment,cerebro,rag,full-stack - Related Documents:
ADR-0013