Repository navigation
overview architecture
Two architectures sit in this repository. Do not mix them.
-
SAFRS six-layer control architecture — how agents are governed (
SAFRS_SPEC.md§3). -
Capsule topology — how products are owned (
MONOREPO_PURPOSE.md, ADR 0005, ADR 0006).
.agents/knowledge/03_ARCHITECTURE.md still describes the implemented solo-developer baseline (golden-path + root packages). That is current-state for the legacy demonstrator, not the intended pattern for new products.
Canonical: SAFRS_SPEC.md §3.
graph TD
L5["L5 — Human Authority<br/>intent, architecture, R3"]
L4["L4 — Executable Governance<br/>CI, checkers, PR gates, evidence"]
L3["L3 — Execution Isolation<br/>worktrees, test DBs, sandboxes"]
L2["L2 — Context and Navigation<br/>AGENTS.md, ADRs, capsules"]
L1["L1 — Constitution<br/>objectives, engineering, security"]
L0["L0 — Trust Boundary<br/>identity, credentials, data class"]
L5 --> L4 --> L3 --> L2 --> L1 --> L0
Constraint descends. Authority ascends. Capability is not trust.
Extends L4 with machine-checked task contracts. Implementation: tools/automation/. Schemas: .safrs/schemas/.
flowchart LR
Contract["Task / run / operation contracts"] --> Risk["Monotonic risk"]
Contract --> Lease["Lease chain + fencing token"]
Risk --> Gates["Eight PR gates"]
Lease --> Gates
Gates --> Evidence["Content-addressed evidence"]
Evidence --> Approval["Time-limited, no self-review"]
Approval --> Publisher["enable_auto_merge only"]
Guard["Shared adapter guard"] --> Gates
Identity separation: the coding agent never holds merge or production-execution authority. Publisher may only enable auto-merge for an exact verified head. R3 stays prepare-only for coding agents.
On top of the automation control plane, Gaffer orchestration routes a Chief's plain-language intent through SOLO/DECOMPOSE, cheapest-qualified worker routing (ECONOMY/STRONG), SAFRS verification, and Root semantic acceptance. Its runtime (tools/automation/src/gaffer/) reuses the SAFRS ports rather than re-implementing contracts, risk, leases, or evidence. The v0.1 Codex provider callbacks are simulated; economic validation is Phase 4.
Canonical: SAFRS_SPEC.md §4, ADR 0005.
projects/<domain>/ routing only (AGENTS.md + README.md)
└── <capsule>/ the portable project
packages/ root shared packages (legacy / authoring)
tools/ control-plane tooling
tests/ repository integration tests
docs/ canonical docs and ADRs
.safrs/ machine policy
.agents/ agent memory
Domains: academic, corporate, healthcare, internal, product. A domain folder with no capsule is a topology error.
pnpm workspace (pnpm-workspace.yaml):
- includes
packages/*,tools/*,projects/*/*/apps/* -
excludes
academic-smartboard,kediri-history,sentrabotso those capsules keep their own lockfiles
flowchart TB
subgraph intended["Intended — every new product"]
Cap["Capsule owns lockfile, packages, infra, lifecycle"]
Ext["Declared external deps only"]
Cap --> Ext
end
subgraph legacy["Current legacy — do not copy"]
Web["golden-path apps/web"]
API["@safrs/api Hono"]
DB["@safrs/database Prisma"]
PG["root compose.yaml Postgres :54329"]
Web --> API --> DB --> PG
end
Golden-path request path (legacy demonstrator only):
sequenceDiagram
participant B as Browser
participant N as Next.js @safrs/web
participant H as @safrs/api
participant P as @safrs/database
participant PG as PostgreSQL :54329
B->>N: GET /
N->>H: /api/health
H-->>N: status ok
N->>P: readiness query
P->>PG: SELECT 1
PG-->>N: ready
N-->>B: readiness desk
B->>N: POST /api/demos
N->>H: catch-all route.ts
H->>H: Zod createDemoInputSchema
H->>P: demo.create
P->>PG: INSERT
H-->>B: 201 serialized demo
Mount point: projects/internal/golden-path/apps/web/src/app/api/[[...route]]/route.ts.
Product runtimes (SentraBot, Kediri, Avery) are documented under projects. They do not use this Hono mount.
Five workflows under .github/workflows/:
| Workflow | Trigger | Purpose |
|---|---|---|
ci.yml |
pull_request | lint, typecheck, test, build, e2e (needs LFS + Postgres service) |
safrs-governance.yml |
pull_request, push to main | Python governance checkers |
safrs-pr-gates.yml |
pull_request, push to main | eight PR gates as matrix jobs |
safrs-task-control.yml |
workflow_dispatch | remote lease authority |
safrs-publish.yml |
workflow_dispatch | publication eligibility |
HANDOFF (2026-08-26) records that GitHub Free private-repo branch protection is blocked pending a billing decision. Do not infer that gates are required on GitHub.
SAFRS — the Sentra Agent-First Repository Standard — defines how a software repository should be structured, governed, and enforced when autonomous Artificial Intelligence agents perform a substantial share of engineering work by Sentra Artificial Intelligence.
SAFRS v1.1 addresses that problem through five coupled mechanisms:
- a six-layer repository architecture from Trust Boundary to Human Authority;
- a role-based permission model in which capability never implies trust;
- a four-tier risk model with cumulative mandatory controls;
- a multi-agent execution protocol with explicit task states and one mutation owner per bounded scope;
- a knowledge governance model that distinguishes current architecture, historical decisions, execution plans, Git history, and running code.
Built in Indonesia as part of the Sentra Artificial Intelligence ecosystem.
Sentra Artificial Intelligence · Source Repository · Official Website
Dr Ferdi Iskandar — Creator & Maintainer
LinkedIn ·
ORCID ·
Hugging Face ·
Kaggle ·
Medium ·
Substack ·
X ·
Threads
MyPrompt · Sentra Artificial Intelligence · Indonesia
- SentraBot
- Kediri History
- Academic Smartboard
- Avery
- Portfolio Dr. Novia
- Golden Path (legacy demonstrator)
- Control Center
- Capsule template
- Risk model (R0–R3)
- Agent roles and permissions
- Capsule sovereignty
- Multi-agent protocol
- Document lifecycle
- Sensitive paths
- Verification integrity
Lore — how this repository grew
- Schemas (
@safrs/schemas) - Environment (
@safrs/env) - Database (
@safrs/database) - API (
@safrs/api) - UI (
@safrs/ui) - Telemetry (
@safrs/telemetry) - Token (
@sentra/token) - Config (
@safrs/config) - Auth (
packages/auth)
- SAFRS governance checkers
- SAFRS Automation Control Plane
- Gaffer Runtime
- Doctor
- Project wizard
- project-standalone
- Capabilities
- Codegen
- Deps-graph
- Status CLI
- Task CLI