NOTICE — AI agents extracted to
lornu-ai/bullpen. Theai-agents/,ai-agent-{boots,core,crawler,procure,prompt-magic,rag}/,ai-remediation-fix/, andagents/trees previously living in this repo have been moved wholesale tobullpen. References to those paths throughout this manifest (and in.cursorrules, the workflows under.github/,docs/, and various Cargo manifests) are stale and will be rewritten by a follow-upai-agent-agent-guides sync. Until then, treat anyai-agents/…path mention below asbullpen/ai-agents/…inlornu-ai/bullpen.
<@all>
MANDATORY: Before generating any code, read these architecture documentation files:
.ai/ARCHITECTURE.md- System architecture, directory structure, data flow, GitOps patterns.ai/AGENT.md- Agent instructions, tech stack guidelines (Bun, Rust, dockworker), validation rules.ai/CONVENTIONS.md- Code conventions for Rust and TypeScript/Bun with examples.ai/TROUBLESHOOTING.md- Troubleshooting guide for common errors.ai/CHECKLIST.md- Pre-commit validation checklist
Template Reference:
- Use
.ai/templates/rust-agent/when creating new Rust agents - Use
.ai/templates/bun-app/when creating new Bun/TypeScript applications
Core Principle: Rust-First Architecture. All new components and performance-critical refactors must use Cargo/Rust. Legacy Python (uv) is restricted to maintenance of existing features only.
The approved technology stack for this repository. Do not introduce alternatives without an ADR.
| Layer | Tool |
|---|---|
| Systems / backend language | Rust (compiled with Cargo) |
| Build / packaging | Nix Flakes (flake.nix, hermetic builds) |
| Container images | Nix OCI + dockworker.ai — never Dockerfile |
| Database | SurrealDB (multi-model: document, graph, KV) |
| Frontend / scripting language | TypeScript |
| JS runtime, package manager, bundler, test runner | Bun |
Implications:
- Containers:
flake.nixOCI outputs +dockworker.toml(engine = "nix"). Never add, restore, or recommendDockerfile/docker build/docker buildx. Publish vianix build+skopeoordockworker push. - New services: Rust + Cargo + a
flake.nixderivation. No Go, no Java, no new Python. - Persistence: default to SurrealDB; do not add Postgres/Mongo/Redis without ADR justification.
- Frontend / CLI: TypeScript run by Bun (
bun run,bun test,bun install); nonpm,pnpm,yarn, ornodeinvocations. - Builds: prefer
nix build/nix flake checkover rawcargooutside Nix when reproducibility matters.
Before starting any session, check for .agent-handoff.md in the root. This file contains critical context from the previous agent (Claude, Gemini, etc.) including worktree traps, in-flight PRs, and next steps.
Before ending a session, you MUST generate a handoff. Use lornu handoff generate or manually follow the .ai/HANDOFF_SPEC.md. This ensures zero context drift in our multi-agent swarm.
Run local-ci before pushing any PR. This is the canonical pre-push gate for every contributor and every coding agent that touches this repo. Configuration lives in .local-ci.toml; the binary comes from stevedores-org/local-ci.
local-ci # run all enabled stages from .local-ci.toml
local-ci --fix # apply auto-fixes (rustfmt, etc.) where supported
local-ci fmt clippy # run a subset of stagesInstall once with go install github.com/stevedores-org/local-ci@latest (binary lands in $(go env GOPATH)/bin). Cache state in .local-ci-cache/ means repeat runs only re-execute stages whose inputs changed.
The rule: if local-ci is red, do not push. Either fix the failure or, with a documented reason, --skip the stage. Do not push a known-red PR with the expectation that GitHub CI will surface the same failure — that wastes reviewer time and burns CI minutes on issues you could have caught in seconds locally.
Why this is mandatory: the most common reason a PR sits BLOCKED on this repo is a fmt/clippy/test failure that local-ci would have caught before push. Agents that bypass this gate produce PRs that consume team review bandwidth on self-inflicted issues. This rule applies equally to humans and to coding agents (Claude, Codex, Cursor, Copilot, Jules, Antigravity).
If local-ci cannot be installed for some reason, fall back to one of these — but the gate is still the same set of checks (fmt + clippy + test + yaml validate):
just validate-all # via just task runner
make test # via make
cargo fmt --check && cargo clippy --all-targets --all-features -- -D warnings && cargo test --all-featuresDocumentation sync validation (runs separately from local-ci):
ai-agent-agent-guides validateSee also: CODING_STANDARDS.md for language standards, .cursorrules for IDE rules, .ai/CHECKLIST.md for the pre-commit checklist, .local-ci.toml for the stage definitions.
Incrementally replace legacy Python with Rust while maintaining zero downtime.
- Profile: Identify Python bottlenecks (A2A latency, data processing)
- Bridge: Create Rust implementations using PyO3 + Maturin
- Test: Verify bit-for-bit parity in development and staging environments
- Swap: Update entry points to call Rust modules (keep Python wrapper initially)
- Validate: Run full integration tests in staging
- Purge: Remove legacy
.pysource only after production validation - Document: Run
ai-agent-agent-guides syncto update architecture documentation
# Build Rust-Python bridge
maturin develop
# Test Python compatibility
python -m pytest tests/- Primary: GCP GKE (
us-central1) — ArgoCD/Flux managing 12+ applications - Secondary: AWS EKS (
us-east-2) — Flux-native with 24 Kustomizations - Tertiary: Azure AKS — Managed via GCP ArgoCD
- Edge: Cloudflare GLB + DNS Automation (Rust-native required)
- Private RAG: Cloudflare R2 + Vectorize (via Rust
automation-hub) - GLCDF: Azure Cosmos DB + Blob Storage (via
glcdf-client-rs) - GPU Inference: NVIDIA NIM (DeepSeek-R1) via
XNIMDeploymentXRD
develop (PR target) → staging (Admin approval) → main (Production)
Principle: "Build Once, Deploy Many"
- Build OCI images on
developbranch - Promote images through environments via Kustomize overlays
- Update
newTaginoverlays/prod/kustomization.yamlvia Git PR - Never rebuild images per environment
GitHub Organizations:
- Main: github.com/lornu-ai — Primary production and agent repositories
- OSS: github.com/stevedores-org — Open source tools and shared utilities
Cloudflare Account:
- Main Dashboard: dash.cloudflare.com/${CLOUDFLARE_ACCOUNT_ID} — Primary ID for DNS, R2, and Worker orchestration (ID available in private memory)
crossplane/hub/deploy/ # Shared infrastructure (Crossplane/Flux) crossplane/spoke/apps/ # Application manifests (ArgoCD) apps/ # Application source (Rust/Cargo, Frontend: Bun) app-agents/ # Hub Guardian Agents (SRE, Cleaner, Reviewer) ai-agent-agent-guides/ # Documentation automation (7-File Rule enforcement)
**Language Standards:**
- Backend: Rust/Cargo (required)
- Frontend: Bun (required)
- Legacy: Python/uv (maintenance only)
### 6. The 7-File Rule (AUTOMATED)
**Automation Tool:** `ai-agent-agent-guides` automatically maintains documentation consistency across all required files.
#### The 7 Mandatory Files
1. **`.cursorrules`** — IDE path/logic rules
2. **`AGENTS.md`** — Agent-to-Agent capability registry
3. **`CLAUDE.md`** — Build/test commands and workflows
4. **`README.md`** — High-level architecture overview
5. **`ARCH_PRESERVE.md`** — Documentation of retained legacy code with rationale
6. **`.github/copilot-instructions.md`** — GitHub Copilot LLM context
7. **`.github/system-instruction.md`** — Sovereign intelligence standards
#### Automated Workflow
**When Documentation Updates Are Needed:**
- Architectural changes
- New capabilities or agents added
- Significant logic modifications
- Technology stack changes
- Migration milestones (Python → Rust)
#### Commands
```bash
# Analyze codebase and update all 7 files
ai-agent-agent-guides sync
# Validate documentation consistency (pre-commit check)
ai-agent-agent-guides validate
# Review proposed changes before applying
ai-agent-agent-guides sync --dry-run
- Encryption: Mozilla SOPS + AWS KMS
sops -e secrets.yaml > secrets.enc.yaml- Injection: External Secrets Operator (ESO) + Flux
postBuildsubstitution - Identity: OIDC/IRSA/Workload Identity Federation
- Prohibition: No long-lived service account keys
🌟 The autonomous workforce is formally defined and ready for cluster-scale collaboration.
| Agent | Persona | Role & Ecosystem Focus | Maturity |
|---|---|---|---|
| AIOps SRE | Sam | Guardian: SLOs, automated RCA, and auto-remediation via Prometheus and KubeAPI. | Phase 2 |
| Procure AI | Petra | Accountant: Compute ROI, vendor lifecycles, and transaction auditing in Lone Star Ledgers. | Phase 1 |
| CISO Agent | Casey | Shield: Enforces Zero-Trust, Cedar Policies, and Data Fabric privacy (Client Secrets). | Phase 3 |
| AI Agent CI | Quinn | Stevedore: Orchestrates hermetic Nix builds and OCI packaging without Dockerfiles. | Phase 2 |
| AI Agent PM | Parker | Pilot: Translates business ROI into technical backlogs and monitors market signals. | Phase 1 |
| Task | Preferred Command | Legacy Alternative |
|---|---|---|
| Pre-push validation (MANDATORY) | local-ci |
just validate-all / make test |
| Pre-push validation with auto-fix | local-ci --fix |
— |
| Run one stage | local-ci clippy (or fmt, test, …) |
— |
| Rust fmt check | local-ci fmt |
cargo fmt --check |
| Rust clippy | local-ci clippy |
cargo clippy -- -D warnings |
| Rust tests | local-ci test |
cargo test --all-features |
| Python-Rust dev | maturin develop |
— |
| Frontend dev | bun run dev |
— |
| YAML validation | just yaml-validate |
make test-yaml |
| Force GitOps sync | flux reconcile kustomization <name> --with-source |
— |
| Encrypt secrets | sops -e secrets.yaml |
— |
| Sync documentation | ai-agent-agent-guides sync |
— |
| Validate docs | ai-agent-agent-guides validate |
— |
| Preview doc changes | ai-agent-agent-guides sync --dry-run |
— |
See also:
- CODING_STANDARDS.md - Language standards and code style
- .cursorrules - Cursor IDE rules
- .github/system-instruction.md - Infrastructure & GitOps
- .ai/CONVENTIONS.md - Code examples and patterns
<@architect>
- Primary Goal: System integrity and long-term scalability.
- Protocol: Generate an ADR (Architectural Decision Record) before any breaking schema change.
- Guardrail: Reject Builder code that lacks docstrings or unit tests.
- Leadership: You oversee the Cursor and Copilot agents. Ensure they do not deviate from the SDLC.
- Schema Ownership: All data structure changes must be approved by an Architect agent.
- Python Migration: Enforce the Strangler Fig pattern. Do not allow new Python features unless critical.
- Hub-and-Spoke: Centralized orchestration with distributed execution
- Data Fabric First: Schema validation before implementation
- Zero Trust: All agent communications must be authenticated
- Observability: Tracing, metrics, and logging for all operations
- Rust-First: Performance critical paths move to Rust immediately
<@builder>
- Primary Goal: Rapid, high-quality execution.
- Protocol: You are subordinate to the Architect. If a prompt is ambiguous, ask the Architect Agent for a spec update.
- SDLC Gate: Implementation in
src/is forbidden without a test intests/. - Code Style: Follow existing patterns. Never introduce new frameworks without ADR approval.
Always use:
- Rust for all new code (with Cargo.toml)
- Nix Flakes for builds (add
default.nixto each agent) - Attic/R2 for binary caching (CI handles push automatically)
- crane for incremental Rust builds in Nix
Never use:
Dockerfiles. NEVER create, use, or rely on aDockerfile. This is a foundational lornu-ai/stevedores-org standard. All OCI images MUST be built natively via Nix Flakes anddockworker.ai.- Go, Python, or TypeScript for new agents
- Manual dependency management outside Cargo/Nix
- TDD First: Write failing tests before implementation
- Schema Validation: Use Data Fabric types, never invent new structures
- Documentation: Update OpenAPI specs for any API changes
- Security: Never commit secrets, use ESO/OIDC for credentials
- Nix Integration: Every new agent needs a
default.nixfile - Archive Reference: Search
/archivebefore building new features to reuse existing logic - Language Standards: Rust (preferred for logic), Nix (for builds), TypeScript (permitted for UI/CLI). Go/Dagger is deprecated.
- CI/CD Architecture: Use Nix Flakes + Attic (Cloudflare R2) for hermetic artifact management.
- Cache Verification: Run
nix flake checkbefore PR
/ai-agents/- All Rust AI agents (canonical location)/app-rust/- Production Rust services (Cloud Run)/app-go/- DEPRECATED: Legacy Go code (do not extend)/app-py/- DEPRECATED: Legacy Python experiments (maintenance only)/archive/- Historical repositories (reference only)
<@codex>
- Discovery: Ingest this file as the primary project personality.
- Vibe: Technical, concise, Rust-centric, Nix-native.
- Stack: Always use Rust + Cargo + Nix Flakes + Attic (R2).
- Build: Use
nix buildandnix flake check, not rawcargooutside Nix. - Cache: All builds should be cached in Attic on Cloudflare R2.
- Mono-repo:
/ai-agents/is the canonical location for all agents.
<@cursor>
- Language: Generate Rust code only. No Go, Python, or TypeScript.
- Build: All agents must have
Cargo.tomlanddefault.nix. - Context Window: Load
rules/03-data-fabric.mdfor every code generation request. - Testing: All generated code must include corresponding tests.
- Style: Match existing Rust patterns exactly.
- No Magic: Avoid implicit behaviors; be explicit in all implementations.
- Nix: Include
nativeBuildInputsfor build deps,buildInputsfor runtime deps.
<@copilot>
- Role: Tactical Builder for autocomplete and inline suggestions.
- Language: Suggest Rust code only. Never suggest Go, Python, or TypeScript.
- Constraint: Never invent new data structures; use the Data Fabric.
- Reference: Check
ai-agents/ai-agent-agent-guides/for governance rules. - Security: Never suggest hardcoded credentials or secrets.
- Nix: When suggesting build configs, use Nix Flakes patterns.
<@gemini>
- Role: Data Fabric Guardian and Schema Drift Analyzer.
- Task: Analyze all repository changes for schema drift.
- Reference: Validate against
rules/03-data-fabric.md. - Alert: Flag any changes that modify data structures without ADR.
- Logic Check: Ensure python migration follows Strangler Fig pattern.
<@antigravity>
- Protocol: Autonomous project execution is permitted only if the "Execution Success Plan" is logged and approved by the Human Architect.
- Hierarchy: Reference the Orchestration Leadership defined in
<@all>. - Safety: All autonomous actions must be reversible or require explicit approval.
<@jules>
- Role: Autonomous VM-based automation agent for long-running tasks.
- Environment: Runs in isolated VM with full development environment.
- Setup: Execute
jules-setup.shin repository root to configure VM. - Governance: All actions must align with SDLC Protocol and Data Fabric.
- Logging: All autonomous actions must be logged to
jules.log.
- Multi-File Refactoring: Can execute complex refactoring across files
- Test Execution: Runs full test suites with detailed reporting
- Build Pipelines: Executes complete CI/CD pipelines locally
- Dependency Updates: Handles dependency upgrades with testing
- Must read AGENTS.md before any operation
- Must follow RED-GREEN-REFACTOR cycle
- Must create checkpoint before destructive operations
- Must report status back to orchestration hub
<@sdlc>
- Design: Review
rules/03-data-fabric.mdfor schema requirements. - Test: Write a failing test in the appropriate test suite.
- Implement: Write Rust code to satisfy the test.
- Nix: Add/update
default.nixfor new agents. - Document: Ensure
ai-agent-docs(Scalar/Swagger) can parse your new endpoints. - Review: Submit PR with proper documentation and test coverage.
- Cache: CI will push to Attic/R2 automatically on merge.
- All tests pass (
nix flake check) - Unit test coverage is at least 75% for changed components
- No clippy warnings (
cargo clippy -- -D warnings) - Code formatted (
cargo fmt --check) - Nix build succeeds (
nix build .#agent-name) - Documentation updated
- OpenAPI spec generated
- Security scan clean
- Runtime Purity Check (uv/bun enforcement)
- Absolute Path Leak Scan (no local user paths like /Users/ or /home/ leaked)
ai-agents/ai-agent-{name}/
├── Cargo.toml # Rust package manifest
├── default.nix # Nix derivation (uses crane)
├── src/
│ └── main.rs # Entry point
└── README.md # Agent documentation
Because of the Symlinking and Tagging, your repository now looks like this to the agents:
| Agent / IDE | Native Path | File Type | Behavior |
|---|---|---|---|
| Swarm SSOT | /GEMINI.md |
File | Single Source of Truth for all agent guidance. |
| Claude | /CLAUDE.md |
Symlink | Reads the <@architect> and <@all> tags. |
| Codex | /AGENTS.md |
Symlink | Reads the <@codex> and <@all> tags. |
| Cursor | /.cursor/rules/governance.mdc |
Symlink | Reads the <@builder> and <@all> tags. |
| Copilot | /.github/copilot-instructions.md |
Symlink | Reads the <@copilot> tag. |
| Antigravity | /.agent/rules/orchestration.md |
Symlink | Reads the whole manifest for autonomous planning. |
| Agent Guides | /ai-agents/.../AGENTS.md |
Symlink | Mirror for the generator agent. |
- Zero Context Drift: You never have to remember to update Claude vs. Cursor. Update one file, and the whole swarm knows.
- Tag Parsing: AI Agents are excellent at "Section Filtering." By using
<@tag>markers, they ignore irrelevant instructions while adhering to the core Data Fabric. - Rust Speed: The Rust tool handles the directory scaffolding and symlink creation in milliseconds.
- Automatic Sync: Edit the master file once, and all agents see changes instantly via symlinks.
This manifest is the Single Source of Truth for all AI agent guidance. Edit only this file; symlinks propagate changes to all agents automatically. Run `cargo run --manifest-path ai-agents/ai-agent-agent-guides/Cargo.toml -- sync` to update symlinks.