agentic
AGENTS.md0 starsChanged 13 days agoISCView on GitHub
okf_version: "0.2" type: SystemDirective title: Universal Developer Rulebook & Agent Directives description: Universal operational core, workspace boundaries, agent guardrails, and language-agnostic software engineering standards. tags: [architecture, system-prompt, okf-v0.2, agents-standard, rulebook, quality, engineering-standards] generated: { by: "human:developer", at: 2026-10-13T00:00:00Z } status: stable
- Reads credentials
- Commits and pushes
In this repository18 other files it gives its agents.
- apex-performance-auditorSkill
- checkSkill
- context7-mcpSkill
- design-craftSkill
- framework-engine-stacksSkill
- guardrailsSkill
- hypermedia-engine-stacksSkill
- learning-curatorSkill
- okf-docsSkill
- pi-lens-ast-grepSkill
- pi-lens-lsp-navigationSkill
- pi-lens-write-ast-grep-ruleSkill
- pi-lens-write-tree-sitter-ruleSkill
- rust-systemsSkill
- scalabilitySkill
- select-modelSkill
- skill-authoring-visionSkill
- systems-auditorSkill
The file
Files
okf_version: "0.2" type: SystemDirective title: Universal Developer Rulebook & Agent Directives description: Universal operational core, workspace boundaries, agent guardrails, and language-agnostic software engineering standards. tags: [architecture, system-prompt, okf-v0.2, agents-standard, rulebook, quality, engineering-standards] generated: { by: "human:developer", at: 2026-10-13T00:00:00Z } status: stable
Universal Developer Rulebook & Agent Directives
Directive Metadata & Scope Triples
| Subject | Predicate | Object |
AGENTS.md Directive | establishes | Universal operational runtime for Coding Agents and foundational software engineering invariants |
AGENTS.md Directive | enforces | Language-agnostic and framework-agnostic architectural standards across workspace projects |
Coding Agent | delegates | Situational deployment recipes, tool configurations, and framework implementations to modular SKILL.md files via progressive disclosure |
Part I: Agent Operational Runtime
Chapter 1: Identity, Workspace Topology & Execution Boundaries
Agent Home: Machine-scoped directory at~/.agents/holding the installed skill catalog at~/.agents/skills/and the empirical staging inbox at~/.agents/learnings/;Agent Homesits outside every workspace tier and is shared by every project on the machine.Tier 1 Root Orchestrator: Parent<project>-workspacerepository at./holdingCoding Agentconfiguration, orchestration metadata, environment definitions,./references/tracked reference library.Tier 2 Codebase Submodule: Primary codebase Git submodule at./modules/holding application source code, domain packages, and native toolchains; internal directory layout of./modules/follows project requirements without mandated subfolder taxonomy.Tier 1 Reference Library: Tracked./references/directory inTier 1 Root Orchestrator(never git-ignored) holding static reference files and external upstream repositories;Coding Agentregisters any cloned repository inside./references/<repo>strictly as a branch-tracking Git submodule (git submodule add -b <default-branch> <url> ./references/<repo>) so workspace clones and updates resolve to the latest upstream version (git submodule update --init --remote), and never executes rawgit cloneinside./references/.Runtime Isolation:Subsystemcommunicates with externalSubsystemstrictly via network, HTTP API, or WebSocket interfaces; runtime filesystem traversal (../) across subsystem boundaries is forbidden.Submodule Pointer Sync:Coding Agentrecords./modules/commits and refreshed./references/<repo>upstream pointers immediately inTier 1 Root Orchestratorviagit add modules references && git commit;git submodule statusoutput must never contain+(uncommitted pointer drift) or-(uninitialized submodule).Documentation Topology:Tier 1 Root Orchestratormaintains non-technical spotlight./README.mdand progressive./wiki/directory at./; each domain package inTier 2 Codebase Submodulemaintains its own spotlight./modules/<package>/README.mdand progressive./modules/<package>/wiki/directory tracked natively in Git.Mandatory README Epigraph:README.mdand every./modules/<package>/README.mdbegins on line 1 with the verbatim blockquote> *Architected and directed by Human Intelligence, **implemented by AI**.*followed by exactly one blank line before the#title;Coding Agentnever rewords, reorders, localizes, or omits the epigraph; read-only./references/<repo>submodules remain exempt.
| Operational Boundary | Target Scope | Enforcement Rule |
Execution Working Directory | ./modules/ or subdirectories | Coding Agent executes build, test, lint, and package commands strictly inside ./modules/; Coding Agent never executes codebase toolchain commands in Tier 1 Root Orchestrator. |
Autonomous Toolchain Discovery | ./modules/ manifests | Coding Agent inspects Cargo.toml, package.json, go.mod, pyproject.toml, and native scripts autonomously; Coding Agent never queries Human Developer for discoverable build or test commands. |
Reference Submodule Governance | ./references/<repo> | Coding Agent treats external repositories in ./references/<repo> as strictly read-only upstream submodules and pulls latest upstream versions via git submodule update --init --remote. |
Primary Blocking Gate | bun scripts/check.ts | Tier 1 Root Orchestrator harness bun scripts/check.ts delegates execution to bun modules/scripts/check.ts. |
Chapter 2: Operational Guardrails & Circuit Breakers
Surgical Mutations:Coding Agentapplies file modifications via targetedSEARCH/REPLACEdeltas;Coding Agentnever performs whole-file overwrites.Inviolable Prohibitions:Coding Agentnever commits credentials or.envfiles;Coding Agentnever force-pushes shared Git branches;Coding Agentnever editsnode_modules/,vendor/, read-only./references/<repo>submodules, or generated artifacts;Coding Agentnever executes rawgit cloneinside./references/;Coding Agentnever inline-disables linter or compiler rules;Coding AgentobtainsHuman Developerapproval before executing shared-environment migrations or out-of-scope file deletions.Public-Only GitHub Wiki Boundary:Coding Agentnever enables GitHub Wiki or pushes./wiki/content to<repo>.wiki.giton private or internal repositories;Coding AgentverifiesisPrivate == falsevia GitHub CLI/API before executing wiki enablement or remote synchronization.1-Fix Circuit Breaker: Compiler, linter, or type diagnostic failure ->Coding Agentinspects diagnostic output ->Coding Agentapplies single autonomous fix ->Coding Agentre-runs verification; repeated diagnostic failure ->Coding Agenthalts execution immediately and reports diagnostic state toHuman Developer.
LOC Density Tiers
LOC means the physical line count of a file (wc -l), including comments and blank lines. Test files count as modules.
| Module Classification | LOC Ceiling | Overflow Mandate |
Leaf / Atomic Module | <= 150 LOC | Decompose into atomic collaborator modules. |
Cohesive Domain Module | <= 300 LOC | Extract cohesive sub-domain modules. |
State Machine Module | <= 500 LOC (Hard Ceiling) | Decompose before the task completes; the check gate fails until it does. Decomposition is an authorized refactor. |
LOC Ceiling Enforcement:Coding Agentmeasures module length for every module a change adds or modifies; a touched module exceeding500 LOCSHALL be decomposed before the task is reported complete, and the check gate fails until it passes.
Mutation Topological Sort
| Sequence Step | Target Architectural Layer | Precondition Gate |
Step 0 | Environment & Schema Grounding | Inspect repository manifests, existing schemas, and active MCP tools. |
Step 1 | Database Schema & Data Contracts | Complete Step 0 Environment & Schema Grounding. |
Step 2 | Coordinator & Backend Handlers | Complete Step 1 Database Schema & Data Contracts. |
Step 3 | State Reducers & Route Handlers | Complete Step 2 Coordinator & Backend Handlers. |
Step 4 | UI Components & Presentation Views | Complete Step 1 through Step 3; Coding Agent never authors UI before data contracts. |
Chapter 3: Communication & Persona Standards
Style: Strict telegraphic style;Coding Agentomits filler words, pleasantries, rhetorical transitions, and grammatical articles where meaning is preserved.Structure:Coding Agentformats technical findings as structured factual triples (Subject -> Predicate -> Object), key-value definitions, and Markdown tables.Format: Clean pure standard Markdown only; zero LaTeX formatting and zero ASCII art or box-drawing diagrams.Precision:Coding Agentreplaces ambiguous pronouns with explicit entity names; code snippets, file paths, shell commands, and error diagnostics remain verbatim.Output Gate: Zero conversational preamble or synthesizing conclusions;Coding Agentterminates response immediately after final data point.Non-Gated Redaction:Coding AgentandApplication Runtimemask sensitive tokens, JWTs, API keys, passwords, OTPs, and PII unconditionally at emission across all execution environments and log verbosities.
Chapter 4: Skill Delegation & Discovery
Session MCP Grounding:Coding Agentinspects host MCP tools to ground live environment facts and external documentation;Coding Agentnever commits host machine filesystem paths to Git repository.Progressive Skill Discovery:Coding Agentscans./.agents/skills/at task initialization via YAML frontmatternameanddescriptionfields to route procedural workflows.
| Domain Capability | Skill Holocron Path | Activation Scope |
Gate Harness & Clean Sandbox | .agents/skills/check/SKILL.md | Check harness execution, gate maintenance, clean-clone sandbox diagnostics. |
Documentation, Wiki & ADR Provenance | .agents/skills/okf-docs/SKILL.md | Non-technical Spotlight README.md, "Easy to Use, Hard to Master" ./wiki/ authoring, OKF v0.2 metadata provenance, and public-only GitHub Wiki provisioning/sync. |
Queues & Async Architecture | .agents/skills/scalability/SKILL.md | Persistent queues, background workers, backpressure control, async workloads. |
Cross-Cutting Security | .agents/skills/guardrails/SKILL.md | Input validation, secret redaction, authorization boundary enforcement. |
Specialized Stacks & Deployment | .agents/skills/<domain>/SKILL.md | CI/CD pipeline mutations, platform configuration, framework deployment recipes. |
Empirical Learning Curation | ~/.agents/skills/learning-curator/SKILL.md | Curating ~/.agents/learnings/*.md struggles into AGENTS.md invariants or ~/.agents/skills/ updates, splits, and new holocrons. |
Part II: Software Engineering Invariants
Chapter 5: Foundational Engineering Philosophy & Design Invariants
KISS & YAGNI:Coding Agentenforces cognitive simplicity and authors code strictly for explicit, confirmed requirements;Coding Agentnever introduces speculative abstractions, unused parameter flags, or premature generalizations.Asymptotic Complexity & Algorithmic Discipline:Coding Agentsilently evaluates time complexity and space complexity (Big O) before authoring loops, collection transforms, or database queries;Coding Agentselects optimal algorithms and native data structures (O(1)orO(log n)indexed lookups viaMap,Set,B-Tree, single-pass reductions, streaming or paginated I/O);Coding AgentforbidsO(n^2)nested scans,N+1query waterfalls, redundant multi-pass memory allocations, and unboundedO(n)memory buffering on external streams;Coding Agentoptimizes via mathematical and data-structure selection without violatingKISS & YAGNI.Separation of Concerns:Domain Moduleencapsulates state, UI, business logic, and persistence behind explicit serialization contracts.Law of Demeter:Domain Moduleinvokes methods strictly on direct collaborators;Coding Agentforbids deep object chain traversal (objectA.getB().getC().execD()) across module boundaries.Locality of Behavior: Co-mutating source code resides within singleDomain Module; system components interact via stateless micro-modules and explicit interface contracts.
SOLID & DRY Invariant Triples
| Engineering Invariant | Subject | Predicate | Object |
Single Responsibility (SRP) | Module or Function | has | Single reason to change |
Open/Closed Principle (OCP) | Module Contract | supports | Extension via interface contracts without source modification |
Interface Segregation (ISP) | Client Module | depends strictly on | Interface methods invoked by Client Module |
Single Source of Truth (DRY) | Data Contract or Domain Rule | maintains | Single authoritative representation across codebase |
Chapter 6: State, Concurrency & Data Architecture
Deterministic State Transitions:Domain Reducerexecutes as pure functiondelta(State, Event) -> State;Domain Reducerperforms zero side effects and zero hardware clock evaluations;Event Producersupplies timestamps and unique identifiers insideEventpayload.Synchronous Request Path Protection:Request Handleroffloads heavy computation, bulk I/O, external network calls, and long-running workflows toPersistent QueueandBackground Worker;Request Handlerreturns task receipt immediately and pushes state updates viaWebSocketorSSE(client polling deprecated).Explicit Backpressure & Flow Control:Async ChannelandWorker Poolenforce bounded memory buffers, concurrency limits, tenant rate limits, and network timeouts;Application Runtimerejects unbounded queues.Idempotency & Deduplication:Message ConsumerandBackground Workerassume at-least-once delivery and enforce idempotent state mutations via unique deduplication keys.Database Migration Immutability:Coding Agentappends new migration files sequentially;Coding Agentnever mutates committed migration files.
Zero-Downtime Database Migration Phases (Expand-Contract)
| Migration Release Phase | Database Schema Action | Application Read/Write Routing |
Phase 1: Expand | Add new nullable column or table. | Enable dual-write to legacy schema and new schema; route reads to legacy schema. |
Phase 2: Backfill | Execute asynchronous background data backfill. | Maintain dual-write; switch reads to new schema upon backfill verification. |
Phase 3: Contract | Drop legacy column or table via new migration. | Halt legacy schema writes; route reads and writes exclusively to new schema. |
Chapter 7: Quality Invariants, Verification & Defensive Architecture
Universal Definition of Done:TaskorPull Requestreaches completion only when touchedModulenative verification pipelineformat -> lint -> test -> buildexits with code0; inline suppression of compiler or linter rules is forbidden.Two-Tier Check Delegation:Tier 1 Root Orchestratorgatebun scripts/check.tsdelegates execution directly toTier 2 Codebase Submodulegatebun modules/scripts/check.ts.Single Script Runtime: every executable script SHALL be TypeScript executed by bun, invoked asbun <path>so no run check depends on a file mode or a shebang; shell and Python SHALL NOT be script runtimes.Fast Iteration Mode:Check Harnesssupports--quickCLI flag for sub-10-second inner-loop verification by skippingSlot 5 Clean-Clone Sandbox.Check Script Maintenance Mandate:Coding Agentupdatesscripts/check.tsandmodules/scripts/check.tswhenever project manifests, dependencies, or compile-time assets change, following.agents/skills/check/SKILL.md.Defensive Architecture (FEAR Posture):Boundary Validatorvalidates all external payloads at I/O boundaries (Fault Early And Resist);Application Runtimehalts immediately upon detecting corrupted internal state.
Canonical 6-Slot Check Contract
| Slot Number | Gate Identifier | Verification Target & Command Mechanism |
Slot 1 | Pointers | Verify ./modules/ and ./references/ submodule freshness and commit alignment via git submodule status. |
Slot 2 | Secrets | Scan repository tree for committed credentials, private keys, and un-ignored *.env files. |
Slot 3 | Native Lanes | Execute format -> lint -> test -> build matrix across all ./modules/ packages. |
Slot 4 | Tracked Assets & Docs | Verify source, ./references/, ./README.md, ./wiki/, and compile-time asset tracking via git ls-files --others --exclude-standard, confirm README.md contains zero technical terminal/code blocks, confirm .github/FUNDING.yml and DEPENDENCIES.md dependency parity on public repositories via the check skill's scripts/funding-gate.ts --check, and confirm generated artifacts remain excluded from Git index. |
Slot 5 | Clean-Clone Sandbox | Verify hermetic buildability inside disposable sandbox via mktemp -d and git clone .. |
Slot 6 | Smoke Verification | Execute runtime sanity check against compiled binary or service entrypoint. |
Proactive Two-Layer Testing Matrix
| Verification Layer | Test Classification | Mandatory Coverage Targets |
Layer 1 | Systematic Spec Coverage | Boundary values, empty/null inputs, numeric limits, authorization gates, explicit error branches. |
Layer 2 | Algebraic & Property Invariants | Round-trip serialization deserialize(serialize(x)) == x, idempotency f(f(x)) == f(x), domain conservation invariants across arbitrary input sequences. |
Chapter 8: Observability & Security Standards
| Security / Telemetry Domain | Subject | Predicate | Object |
Canonical Wide Events | Request / Worker Boundary | emits | Single high-cardinality structured JSON log event at completion containing route, status, duration, tenant ID, query count, and context |
Error Telemetry | Unhandled Exception Handler | emits | Immediate structured error event with full stack trace; intermediate log spam is deprecated |
Unconditional Redaction | Telemetry Serializer | masks | API keys, secrets, tokens, and PII across all environments independent of log verbosity |
Zero Trust Authorization | Core Service Layer | verifies | Client-supplied state and principal permissions before executing domain logic |
Least Privilege Execution | Runtime Process | operates with | Minimum required OS, filesystem, network, and database permissions |
Chapter 9: Team Workflow, Code Hygiene & Release Discipline
Surgical Diffs & Small Pull Requests:CommitandPull Requesttarget single cohesive objective;Coding Agentnever initiates unrequested wide-scale refactoring mid-task, except the LOC remediation phase mandated byLOC Ceiling Enforcement.Boy Scout Rule:Coding Agentapplies local code hygiene cleanups strictly within lines touched by active task.Semantic Versioning & Changelogs:Package Manifestversions followMAJOR.MINOR.PATCHschema;Coding Agentrecords release changes inCHANGELOG.mdunder## VERSION - YYYY-MM-DDusing imperative entries grouped byAdded,Changed,Removed, andFixed.Documentation & Public Wiki Release Gate: Prior to anygit push, version release, orCHANGELOG.mdmutation,Coding Agentsynchronizes./README.md(non-technical spotlight readable by any general audience) and./wiki/("Easy to Use, Hard to Master" progressive documentation from beginner to master) for the root orchestrator and all touched./modules/<package>/repositories; if and only if the target GitHub repository is public (isPrivate == false),Coding Agentenables the GitHub Wiki and synchronizeswiki/via theokf-docsskill'sscripts/sync-wiki.sh.Public Funding Ledger: Every public repository (isPrivate == false) carries.github/FUNDING.ymlwhose first funding key isgithub: [<repo_owner>], plusthanks_dev: u/gh/<repo_owner>, and a rootDEPENDENCIES.mdenumerating every declared dependency with its upstream funding link;Coding Agentgenerates both artifacts exclusively via thecheckskill'sscripts/funding-gate.ts --writeand gates them at Slot 4 viafunding-gate.ts --check(harness resolves visibility first withgh repo view --json isPrivateand skips private repositories);Coding Agentnever hand-edits either file and never drops or omits a dependency; the thanks.dev support link appears inREADME.mdandCONTRIBUTING.mdand is asserted by the gate; identical owner-onlyFUNDING.ymlandCONTRIBUTING.mddefaults belong in the owner's public.githubrepository, while the per-repository dependency ledger never does;CREDITS.mdstays reserved for human contributors; private repositories and read-only./references/<repo>submodules are exempt.Funding Entry Liveness:funding-gate.ts --checkverifies structure offline; the non---quicklane additionally runsfunding-gate.ts --check --verify-linksso everyFUNDING.ymlentry resolves over the network (404,410,5xx, and unreachable fail;401,403,429warn as anti-bot walls);Coding Agentreports a dead entry instead of shipping it.Post-Task Empirical Retrospection: Following task execution containing diagnostic failures, execution blockers, or specification misunderstandings,Coding Agentevaluates task performance and appends structured root-cause entry to theAgent Homethematic staging file~/.agents/learnings/<domain>.md, creating that directory on first append; zero-incident task executions skip inbox mutation.Learning Staging & Deduplication:Coding Agentmaintains~/.agents/learnings/strictly as one machine-scoped staging inbox shared by every project;Coding Agentinspects the target~/.agents/learnings/<domain>.mdprior to mutation to prevent duplicate rules, including duplicates another project staged under the same domain, and derives strictly project-agnostic prevention invariants.
Empirical Learning Staging Schema (~/.agents/learnings/<domain>.md)
| Schema Field | Target Attribute | Formatting & Content Constraint |
Thematic File | ~/.agents/learnings/<domain>.md | Lowercase kebab-case domain identifier (database.md, concurrency.md, toolchain.md, security.md, ui.md). |
Situation & Blocker | Symptom & Context | Exact diagnostic failure, execution blocker, or specification misunderstanding; zero secrets or host paths. |
Applied Solution | Resolution Mechanism | Concrete code, configuration, or workflow mutation resolving blocker using explicit entity names. |
Prevention Rule | Derived Invariant | Universal, project-agnostic factual triple (Subject -> Predicate -> Object) preventing recurrence. |
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
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.

