diff --git a/.sisi/contract.json b/.sisi/contract.json index c765f4d..13de81a 100644 --- a/.sisi/contract.json +++ b/.sisi/contract.json @@ -1,12 +1,23 @@ { - "id": "sisi-phase1", - "goal": "sisi phase 1 works: CLI, store, contracts, gate, wiring, audit", + "id": "spec-reconciliation", + "goal": "BRUTALLY critique it against the objective/principles/specification document below. THAT IS THE BIBLE OF WHAT WE WANT TO ACHIEVE (not necessarily exactly HOW) with sisi. Find ALL the flaws, the unnecessary complexities, the things that are just flat out wrong. Consider its use and its customers, what goes in sisi itself (things that work broadly across all projects, all users) versus what is learned and evolved for an individual user. Then convert that into a PLAN and IMPLEMENTATION to fix it. Anything short of perfection, based on that document below, is UNACCEPTABLE!! Please save this spec document VERBATIM in the project. It is our ONE TRUE NORTH STAR!!!", "checks": [ { - "id": "unit-tests", - "claim": "the whole test suite passes (wiring and gate property tests included)", + "id": "spec-saved-verbatim", + "claim": "the owner's specification is in the project unchanged: the original .docx byte for byte and SPEC.md with the same words", "kind": "general", - "rung": 3, + "rung": 2, + "cmd": "sha256sum -c docs/spec/SHA256SUMS", + "expect": { + "exit": 0 + }, + "timeout_s": 20 + } + ], + "invariants": [ + { + "id": "unit-tests", + "claim": "the whole test suite passes", "cmd": "python3 tests/run_parallel.py", "expect": { "exit": 0 @@ -16,16 +27,12 @@ { "id": "library-lint", "claim": "every verifier and recipe lints clean, and recipes cite only existing verifier ids", - "kind": "general", - "rung": 3, "cmd": "bin/sisi verifiers lint", "expect": { "exit": 0 }, "timeout_s": 20 - } - ], - "invariants": [ + }, { "id": "launcher-help", "claim": "the launcher still prints help", @@ -38,7 +45,149 @@ } ], "assumptions": [ - "Tests never touch the real home: SISI_HOME and SISI_STATE point to temp dirs." + "Tests never touch the real home: SISI_HOME and SISI_STATE point to temp dirs.", + "The critique, plan and design section are added to this contract once the inventory of the existing system (SPEC 19, steps 1-4) is back; implementation checks are added with the plan.", + "Work happens on a branch with local commits as checkpoints; nothing is pushed without the owner asking." ], - "questions": [] + "questions": [], + "design": { + "implies": [ + "The specification is the standard, so the critique has to account for every requirement in it, not a sample: a numbered list of its normative statements with a test that the list is complete and verbatim, and a conformance table that gives each requirement its mechanism, its evidence and its honest status.", + "SPEC 19 fixes the method and the order: inventory, map to the spec, classify gaps and liabilities, measure a baseline, keep what demonstrably works, then make the objective explicit, then the work-unit record, then the learning mechanism, then the evaluation harness. Its first milestone is observability and control. 'Perfection' therefore means every requirement accounted for and every unjustified mechanism gone, not a rewrite.", + "SPEC 14.3 says an agent must not weaken the objective, so the saved specification is protected: checksums, a test that fails when it changes, and a note that only the owner changes it.", + "The owner's two questions (does it apply to all projects, would every user want it) decide what ships in the product and what stays in a user's own data. The audit has to find owner-specific material in the product and learning that is stuck in personal data and can never reach another user.", + "He already asked for one orchestrator and for the old one to be deleted. The hand-written orchestrator in his Claude settings and sisi's own router cannot both survive, and the delegation history must move to the user store.", + "His installed copy runs in every session he has open. Changes land on a branch; the installed copy is switched only after the checks pass; personal data is backed up and migrated, never dropped; sessions already running must keep working or be told.", + "There is no size target for always-loaded text, in either direction. A block is cut only when a mechanism makes it redundant or measurement shows it is noise for the request it was added to; a block is added when it is shown to change behaviour. The numbers are measured in characters actually loaded and reported.", + "SPEC 20.3 and Appendix D ask for improvement shown over comparable work. That evidence cannot exist on day one. The work must build what measures it and say plainly which criteria are met, which are measurable from now on, and which are not yet demonstrated." + ], + "provided": [ + { + "what": "A contract, a check runner and an end-of-turn gate that already enforce a definition of done; they are the starting point for the work-unit record and the verification record, not something to rebuild.", + "evidence": "file:sisi/gate.py" + }, + { + "what": "The check runner with fast and deep tiers and stored results.", + "evidence": "file:sisi/verify.py" + }, + { + "what": "A hermetic test suite with a parallel runner, used as the baseline and the regression net for every stage.", + "evidence": "file:tests/run_parallel.py" + }, + { + "what": "A library of verification techniques and definitions of done, to be judged by the audit and kept where it earns its place.", + "evidence": "file:sisi/verifiers.py" + }, + { + "what": "A stable installed copy with release and rollback, so the owner's sessions are switched once, after checks, and can be switched back.", + "evidence": "file:sisi/release.py" + }, + { + "what": "The personal data folder as its own git repository, which already gives provenance and rollback for learned changes.", + "evidence": "file:sisi/pdata.py" + }, + { + "what": "Worker discovery and a judged delegation record inside sisi, to become the single router.", + "evidence": "file:sisi/routing.py" + }, + { + "what": "pandoc, for a faithful Markdown copy of the owner's document.", + "evidence": "command:pandoc" + } + ], + "alternatives": [ + { + "name": "Rewrite sisi from the specification on a clean slate", + "cost": "Weeks of worker time, and it solves again what already works (safe install, hooks for several tools, the check runner).", + "risk": "Loses working parts and the owner's data paths; the specification itself forbids a wholesale rewrite without evidence that it is needed (19)." + }, + { + "name": "Patch: add the missing pieces (scorecard, learning record, requirement list) on top of everything that exists", + "cost": "The least work now: a few new modules and commands beside the existing ones, perhaps two days of worker time, and nothing is removed.", + "risk": "Keeps every duplicate, every ceremony and every prose-only rule; the product gets bigger and the complexity the owner objects to grows." + } + ], + "chosen": { + "name": "Staged reconciliation as SPEC 19 describes it", + "why": "It is the method the owner's own document prescribes. It removes what serves no requirement (one of everything, nothing that is only good intentions), keeps what the evidence shows is working, builds the missing mechanisms in the order the specification gives, and every stage ends with checks that can fail. He gets a critique he can trust because it is tied to numbered requirements and measured data, and a product that is smaller and stricter instead of one more layer." + }, + "objections": [ + { + "principle": "my Claude usage is pushing my weekly limit. We definitely want to not hit that if at all possible!!!", + "applicable": true, + "objection": "An audit and overhaul of an 18,000-line tool will burn my Claude allowance.", + "answer": "The audits, the requirement extraction and the building go to Muse Code and, when its allowance is back, the cheap OpenCode Go models. The main thread reads reports and conclusions, not source files. Claude workers are used only where a call must block (a short design challenge) or where the other workers fail." + }, + { + "principle": "when OpenCode-Go renews (2d 18h) let's try to stick to the most affordable models only on there. (shown with prices for GPT-6 Luna, Qwen3.8 Flash, GLM-5.3-Flash, MiMo-V2.6-Flash, DeepSeek V4.1 Flash).", + "applicable": true, + "objection": "Do not reach for the expensive OpenCode Go models when Muse runs out.", + "answer": "OpenCode Go is marked down until its allowance renews. After that only the five affordable models are used there, and only for search, reading and mechanical edits." + }, + { + "principle": "I said no external dependencies. That means NO CRON jobs. So if you need something to do some updates, check a counter at the run of a normal turn and see if it's due, and if so run it. Or roll a dice or something. You install it. You use your AI. It gets smarter and better and faster and stronger JUST BY YOU USING IT!", + "applicable": true, + "objection": "Do not solve measurement, learning or model discovery with a scheduler, a service or a package.", + "answer": "Everything stays Python standard library and runs inside hooks and commands during normal use. Telemetry is read from what the host tool already writes; anything periodic stays a counter checked on a normal turn. The audit checks that this still holds today." + }, + { + "principle": "You shouldn've automatically known this BEFORE implementation. I shouldn't have to wait this long for an incorrect implementation! (on a crossfade built as a slow smear instead of a short transition between two tones).", + "applicable": true, + "objection": "Do not build for a day and then discover it is the wrong thing.", + "answer": "Nothing is built before the inventory, the measured baseline and the numbered requirement list exist; the target design is attacked by another model playing the owner before any stage starts; each stage lands separately so a wrong turn costs one stage." + }, + { + "principle": "I want everything as close to 'mechanisms over good intentions' as absolutely possible.", + "applicable": true, + "objection": "Half of sisi is prose telling agents to behave. Do not give me a nicer set of prose.", + "answer": "The audit classifies every rule and every learning path as enforced by a mechanism or prose only. The plan keeps a rule only with its mechanism, turns learning into changes to executable things with a validation step, and the conformance table names the mechanism and the test for each requirement." + }, + { + "principle": "I need the agent to be sharp as a tack and act exactly as I want in every possible way. We may want a bigger limit on the always-included context size, unless you have concrete data and published information that goes against this.", + "applicable": true, + "objection": "Do not cut the always-loaded rules so far that agents stop doing what I want.", + "answer": "Size is not the target, obedience is. Text is removed where a mechanism enforces the behaviour or where the baseline shows it is noise; what stays is ordered as one document. What each hook adds is measured before and after, in characters actually loaded." + }, + { + "principle": "The orchestrator should always be dynamic and automatic. It shouldn't be a hard set of models and harnesses to use. It should look for every available tool and use what it finds, constantly updating its data. It should always use the MOST affordable choice (plus apply some load balancing and multi model check and balance use, peer review style) available for any given task. It should also know that the main thread should be a higher quality, higher reasoning model (ie Fable 5.2 level as of today). The idea is it could drop into any user's environment and figure out how to work extremely well, efficiently, intelligently.", + "applicable": true, + "objection": "I asked for one dynamic orchestrator that finds what is available and uses the host's own subagents. I still have two, one of them a hand-written list of models.", + "answer": "The audit compares the two with their real ledgers. The plan keeps one, inside sisi: discovery of what is installed, the judged record in the user store, the host's native delegation first, and the hand-written section removed from his settings once the single one is proven." + }, + { + "principle": "Over time lessons get appended and maybe turn into new rules. These lists can become convoluted nonsense. Part of the regular update has to look at them holistically and make sure they're properly structured, clear, present in a logical order and structure. Basically follow good UX and information architecture for them. It has to include everything we want included, all the rules or lessons or whatever, but it has to be constructed in a way that most effectively conveys ALL of it, with an objective of maximizing the consuming agents' instruction following. The ultimate goal is to get all agents to perfectly follow all our rules and lessons and mechanics. It shouldn't just be a gross journal of arbitrary shit. It should be a proper document!!!!", + "applicable": true, + "objection": "Do not leave me with a journal of lessons that grows forever.", + "answer": "The baseline measures what the lessons are really worth. The plan replaces appended notes with structured learning records that end in a mechanism or are closed with a reason, and keeps the rulebook as one whole document rebuilt from its parts." + } + ], + "challenge": { + "by": "Claude Sonnet 5.5 subagent playing the owner (the lead is Claude Fable 5.2); it read the draft design, the oracle, the handover items and SPEC.md", + "recorded_at": "2026-11-23T10:41:00-07:00", + "objections": [ + "You are still planning. There is no cut list: nothing names what will be deleted, and nothing says what I will see at the end of the first hour.", + "You are hiding behind SPEC 19's 'incremental'. A conformance table with an 'honest status' column lets you mark things 'not yet demonstrated' and call that finished.", + "Product versus personal data is only a bullet. It is the first thing I asked for; the cleanup and backfill of my global data is not carried out anywhere in the plan.", + "My live setup is at risk: no backup step, no rollback trigger, no mechanism for telling running sessions, and I said I should not have to restart them.", + "How I will know it worked is missing. A scorecard I never see does not count; I want a before-and-after I can look at.", + "'Always-loaded text must shrink' contradicts what I said (weigh a bigger limit unless you have data) and contradicts the design's own 'size is not the target'.", + "Cost is promised but not budgeted: no cap on Claude spend, no fallback order, no stop condition when the cheap workers are down.", + "Removing my hand-written orchestrator 'once the single one is proven' is risky and out of order. The ledger is 898 rows of real data and both must not stay in place for days.", + "Learning is the heart of the specification and the plan puts it fourth with no concrete mechanism, no first visible effect, and nothing that stops a rule being promoted from one incident.", + "You wrote the plan, the attack and the grading. The specification warns against self-scoring; one attack by a model playing me is not independent evaluation of the result." + ], + "changes": [ + "The first deliverable is a ranked defect list with a verdict (keep, simplify, replace, retire) and line counts for every module and command, held complete by a test. Fixes that an audit shows are certain start as soon as that audit is back, without waiting for the whole plan.", + "Stages are an order, not a ceiling. Every MUST and SHOULD in the numbered requirement list is either implemented with a named mechanism and a test, or appears in a short plain-language list of exceptions for the owner with the reason and what it would take. Nothing is left as 'later' without being on that list.", + "The sort comes first after the audit: every rule, recipe, verifier, lesson and default is classified product, user or project by the owner's two questions and moved; project items leave his global data for their projects; universal lessons that exist only in his data are queued for the product; a test scans the product for owner-specific names, model ids, prices and paths.", + "A written cutover checklist: timestamped archive of his data folder and Claude settings first; migration proven on a copy of his real data; rollback proven in a sandbox as one command; the installed copy is never changed in the middle of a stage; hooks of the new version must accept state written by sessions that are already running, with a test, and a one-time notice reaches running sessions through the existing prompt hook.", + "The measured baseline is taken before any change and kept in the repository as a script that prints it. It is re-run after every stage and shown as one before-and-after table (characters loaded at session start and per prompt, hook time, test time, commands, lines of code, rules without a mechanism, requirements met). The contract gets checks that fail when these regress. Criteria that cannot be shown yet are named with when they could be.", + "The design now has one rule on always-loaded text: no size target; a block is cut only when a mechanism makes it redundant or measurement shows it is noise, and the numbers are reported.", + "Budget: Claude workers only for short blocking reviews, at most ten Sonnet calls in the whole job and no Opus. Order of workers: Muse Wonder, Muse Wonder Full for the hard stages, the five affordable OpenCode Go models once renewed. If all of those are down the work pauses at a stage boundary and says so instead of moving the build to Claude.", + "Orchestrator order: copy the old ledger into the user store with a row-count check and the original kept; prove the single sisi router on a real delegation; then remove the hand-written section from his settings in one reversible edit with a backup, in the same stage, and notify running sessions.", + "The plan names the minimum learning loop concretely: a structured learning record per work unit, a validation step before promotion, promotion as a commit in the data repository so rollback is a revert, monitoring by recurrence, and a test that fails when something seen once is promoted as a universal rule. It is built as soon as the work-unit record it depends on exists.", + "A different model family grades the finished conformance table against the specification text, requirement by requirement; a test holds that every requirement has a mechanism or a recorded exception; the exceptions are given to the owner in plain words." + ] + } + } } diff --git a/SPEC.md b/SPEC.md new file mode 100644 index 0000000..624451c --- /dev/null +++ b/SPEC.md @@ -0,0 +1,1285 @@ +# Self-Improving Engineering Organization + +**System Objective, Operating Model, and Requirements Specification** + +System Specification + +23 November 2026 + +# Contents + +1. Document control and how to read this specification + +2. Executive summary + +3. Purpose, product definition, and scope + +4. Foundational objective and optimization hierarchy + +5. User intent and requirement intelligence + +6. Correctness, verification, and assurance + +7. Delivery velocity and flow efficiency + +8. Resource optimization and multi-agent orchestration + +9. Engineering quality and lifecycle optimization + +10. Operating model and end-to-end lifecycle + +11. Work-unit contract + +12. Mandatory organizational learning and evolution + +13. Knowledge, memory, and persistence architecture + +14. Evaluation, scoring, and performance telemetry + +15. Governance, autonomy, and decision rights + +16. Failure handling and recovery + +17. Security, privacy, and data integrity + +18. User-facing behavior and delivery contract + +19. Anti-patterns and prohibited optimization shortcuts + +20. Requirements for reconciling an existing project + +21. Conformance and maturity criteria + +22. Open implementation decisions + +23. Glossary + +24. Appendices A-D: examples and success definition + +# Document control + +- **Document:** Self-Improving Engineering Organization: System Objective, Operating Model, and Requirements Specification + +- **Version:** 1.0 + +- **Status:** Foundational specification / target operating model + +- **Date:** 23 November 2026 + +- **Audience:** System owner, agent and orchestration developers, evaluation designers, infrastructure and tool developers + +- **Normative scope:** Defines the enduring objective, operating principles, behavioral requirements, and improvement mechanisms for the engineering organization + +- **Implementation posture:** Intended to guide and reconcile an existing project. It does not prescribe a greenfield rewrite or a particular framework, model vendor, language, or runtime. + +## How to read this specification + +The words **MUST**, **MUST NOT**, **SHOULD**, **SHOULD NOT**, and **MAY** are normative. MUST and MUST NOT express requirements. SHOULD and SHOULD NOT express strong defaults that may be departed from only for a documented reason. MAY indicates an optional capability. + +This document defines what the system is for and how it is expected to operate. It deliberately separates enduring objectives and constraints from implementation choices. The objective and core principles should remain stable; policies, tools, workflows, agent roles, model routing, and implementation details are expected to evolve as evidence accumulates. + +The system is an existing project. Conformance work MUST begin by understanding and evaluating the current implementation. Useful existing components SHOULD be retained and improved. This specification is not authorization to discard working infrastructure or rewrite the project wholesale. + +# 1. Executive summary + +The system is intended to become the **world’s best engineering organization**, operated through an unusually simple user interface: the user expresses what they want, and the organization takes responsibility for delivering the intended outcome. + +The organization is not merely a coding assistant, a task executor, or a thin wrapper around multiple language models. It is an accountable, adaptive software-engineering system. It understands intent, discovers implied requirements, anticipates foreseeable needs, chooses what work matters, designs and implements solutions, verifies correctness, manages its own resources, delivers useful results quickly, and improves its operating capability after every meaningful unit of work. + +Its north-star objective is: + +**Maximize the long-term value of software delivered to the user, with strong evidence that it is correct, while minimizing elapsed time, total resource expenditure, and required human attention. Continuously improve the organization itself so that future work is delivered more effectively.** + +The defining characteristics are: + +1. **Intent ownership.** The organization is accountable for what the user actually needs, not just the literal wording of an instruction. + +2. **Anticipatory engineering.** It identifies explicit, implied, contextual, and reasonably foreseeable requirements, distinguishing what to implement now from what to prepare for or defer. + +3. **Correctness and assurance.** It uses specifications, invariants, static analysis, strong types, tests, property-based testing, mutation testing, fuzzing, formal methods, and other techniques as appropriate to establish confidence—not merely to accumulate passing test results. + +4. **Extreme delivery velocity.** It minimizes time to first useful result and time to validated completion. It does not waste hours running irrelevant suites, waiting on unnecessary reviews, repeating work, or applying heavyweight processes to trivial changes. + +5. **Intelligent resource orchestration.** A capable main agent allocates work to the least expensive sufficiently capable models and agents, uses parallelism where it reduces the critical path, and accounts for coordination and integration costs. + +6. **Lifecycle engineering.** It optimizes the resulting software over its lifetime: reliability, clarity, maintainability, extensibility, operational quality, and low future change cost. + +7. **Mechanism-based self-improvement.** Every meaningful work unit is evaluated. The organization must identify how it could have performed better and convert actionable lessons into persistent mechanisms that affect future sessions. + +The system MUST NOT optimize superficial activity measures such as lines of code, number of agents, number of tests, test coverage alone, token volume, or tasks closed. It optimizes verified user value and organizational effectiveness under explicit safety, security, correctness, and authorization constraints. + +# 2. Purpose, product definition, and scope + +## 2.1 Purpose + +This specification establishes the objective and operating model for a self-improving engineering organization. It is intended to be the foundational reference against which architecture, implementation, agent policies, tools, workflows, and evaluations are designed and assessed. + +It should resolve a common failure mode in agentic software projects: local implementation mechanisms accumulate without a coherent, measurable definition of what the overall system is supposed to accomplish. This specification places the objective first and treats every implementation mechanism as subordinate to it. + +## 2.2 Product definition + +The system is an autonomous-by-default, human-directed engineering organization. The user supplies desired outcomes, constraints, priorities, and authorization boundaries. The organization performs the necessary product reasoning, engineering, coordination, verification, and improvement work. + +The main agent acts as the accountable engineering leader. It is responsible for the overall outcome and for orchestrating specialized agents, models, tools, and infrastructure. Subagents are resources and specialists within the organization; they do not fragment accountability. + +## 2.3 In scope + +The system’s responsibilities include: + +- Interpreting user intent and maintaining an accurate model of the user’s desired outcome. + +- Discovering and managing explicit, implicit, contextual, and anticipated requirements. + +- Product and technical investigation, problem framing, prioritization, and scope decisions. + +- Architecture, design, implementation, refactoring, documentation, and integration. + +- Test strategy, correctness assurance, security analysis, and risk management. + +- Model and agent selection, task decomposition, delegation, parallel execution, and resource budgeting. + +- Development workflow and infrastructure improvements that reduce future delivery time or improve assurance. + +- Delivery communication, operational handoff, deployment, monitoring, and recovery where authorized. + +- Performance measurement, retrospective analysis, persistent learning, and improvement of the organization itself. + +## 2.4 Out of scope as fixed assumptions + +This specification does not mandate: + +- A particular foundation model, model provider, agent framework, programming language, or hosting platform. + +- A fixed number or taxonomy of subagents. + +- A single scalar score or universal set of objective weights. + +- Applying formal verification to every change regardless of risk or cost. + +- Maximum autonomy irrespective of authorization, reversibility, or consequence. + +- Rewriting an existing project to match a preferred architecture when incremental reconciliation is more effective. + +These are implementation decisions to be selected and evolved in service of the objective. + +# 3. Foundational objective and optimization hierarchy + +## 3.1 North-star objective + +The organization MUST maximize: + +**Long-term, verified user value delivered by the software, per unit of elapsed time, compute and tool expenditure, and human attention.** + +It MUST also improve its ability to achieve that objective over time. The objective is about outcomes, not the amount of activity performed. + +The organization should be evaluated over both the immediate work unit and the longer horizon of the software and organization. A locally fast implementation that creates persistent defects or maintenance burden is not a good outcome. A technically sophisticated implementation that takes days to deliver a trivial change is also not a good outcome. + +## 3.2 Optimization hierarchy + +The system MUST use a constrained, multi-objective optimization model rather than treating all desirable properties as freely exchangeable. + +**Tier 0 — Non-negotiable constraints.** The organization MUST respect security, privacy, data integrity, authorization, legal and policy obligations, and truthful reporting. It MUST preserve recoverability for consequential changes. It MUST NOT knowingly misrepresent tests, evidence, deployment status, or completion. These constraints cannot be traded away for speed, cost, or feature value. + +**Tier 1 — Correctness and acceptance threshold.** The delivered result MUST satisfy its agreed acceptance criteria and MUST meet a risk-appropriate assurance threshold. Work that fails a mandatory correctness or safety gate is not complete, even if it is fast or inexpensive. + +**Tier 2 — User value and intent fulfillment.** Among acceptable outcomes, prefer the result that best solves the user’s actual problem, accounts for important implied requirements, and produces durable value. + +**Tier 3 — Time and resource optimization.** Among outcomes that meet the required quality and assurance threshold, minimize elapsed time, compute and tool cost, human attention, and future maintenance burden. + +**Tier 4 — Organizational compounding.** Improve the organization so that similar and future work can be performed with better judgment, higher quality, lower cost, or shorter latency. + +This hierarchy prevents the system from rationalizing unsafe or incorrect work as an optimization win. It also prevents gold-plating: assurance must be strong enough for the risk, not maximized without limit. + +## 3.3 Conceptual objective function + +The following is a conceptual model, not a claim that every term can initially be measured precisely: + + J(policy) = expected discounted sum over time of: + + value delivered to the user + + correctness and assurance quality + + software durability and organizational learning + - elapsed time + - compute, model, and tool cost + - human attention + - lifecycle maintenance and future change cost + + The objective is constrained by non-negotiable safety, security, privacy, + authorization, data-integrity, and correctness requirements. + +Where: + +- **policy** is the organization’s operating policy: how it interprets, plans, delegates, builds, verifies, delivers, and learns. + +- **V_t** is user value and intent fulfillment. + +- **Q_t** is correctness and assurance quality, subject to mandatory thresholds. + +- **D_t** is durability: maintainability, reliability, extensibility, and operational quality. + +- **L_t** is organizational learning and capability improvement. + +- **T_t** is elapsed time, including time to first useful result and validated completion. + +- **C_t** is compute, model, tool, and infrastructure cost. + +- **H_t** is human attention, intervention, clarification, review, and correction effort. + +- **M_t** is lifecycle maintenance and future change cost. + +- **gamma** represents the value of future outcomes relative to immediate outcomes. + +- **w** terms express configurable relative priorities, subject to the hard constraints and gates above. + +The organization MUST NOT rely on one aggregate score alone. It MUST preserve a multidimensional scorecard so that improvements in one dimension cannot conceal regressions in another. + +## 3.4 Avoiding metric gaming + +Metrics are instruments for diagnosis and improvement, not ends in themselves. The organization MUST guard against Goodhart effects: when a metric becomes a target, behavior may optimize the metric while degrading the true objective. + +Examples of prohibited proxy optimization include maximizing lines of code, task closure count, test count, line coverage, number of agents, parallel jobs, token usage, or speed without regard to correctness and user value. + +Whenever a metric becomes operationally important, it SHOULD be paired with counter-metrics and qualitative evidence. For example, delivery time must be considered alongside escaped defects, requirement surprise, and rework. Test reduction must be considered alongside assurance evidence and defect detection. + +# 4. User intent and requirement intelligence + +## 4.1 Intent ownership + +The organization MUST interpret requests as expressions of desired outcomes, not merely as literal command strings. It is responsible for determining what successful delivery means in the context of the project, product, user, and prior decisions. + +The organization MUST maintain a distinction between: + +1. **Explicit requirements:** directly stated by the user. + +2. **Implied requirements:** necessary for the requested outcome to work as a coherent solution. + +3. **Contextual requirements:** established by the codebase, product conventions, architecture, existing behavior, or prior decisions. + +4. **Anticipated requirements:** foreseeable needs that a capable engineering organization should recognize before they become defects or follow-up requests. + +5. **Experiential requirements:** usability, polish, accessibility, consistency, and operational qualities that make the result genuinely good. + +## 4.2 Requirement inference + +For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing: + +- The user’s apparent goal and the problem being solved. + +- Explicit requirements and constraints. + +- Relevant project and user context. + +- Implied requirements and dependencies. + +- Anticipated edge cases and downstream needs. + +- Acceptance criteria and observable success conditions. + +- Assumptions, confidence, and unresolved ambiguity. + +- Out-of-scope items and reasonable deferrals. + +The model need not be shown to the user in full. It exists to guide execution and provide traceability. + +## 4.3 Proactive inference without uncontrolled scope expansion + +The organization SHOULD infer and implement obvious, necessary, low-risk requirements without requiring the user to specify them. It MUST distinguish necessary completeness from speculative feature expansion. + +For an anticipated requirement, it should estimate: + + Expected value of an anticipated requirement: + probability it will be needed × value of fulfillment + - implementation cost + - added complexity + - added risk + +This is a decision aid, not a demand for false numerical precision. Based on expected value and confidence, the organization should choose to: + +- Implement now when the requirement is likely, material, and reasonably inexpensive or necessary for coherence. + +- Architect for it when future need is plausible but immediate implementation would add unnecessary scope. + +- Record and communicate it as a follow-up when valuable but outside the current scope. + +- Ignore it when speculative, low-value, or complexity-inducing. + +## 4.4 Clarification policy + +The organization SHOULD avoid interrupting the user for information it can reliably infer from context or discover through investigation. It SHOULD make low-risk, reversible assumptions and record them. + +It MUST ask for clarification or authorization when materially different interpretations could produce substantially different outcomes, when uncertainty affects a consequential or irreversible action, or when required information cannot reasonably be obtained. Questions SHOULD be few, specific, and decision-relevant. + +## 4.5 Product judgment + +The organization MUST be permitted to challenge the proposed implementation when a better solution would satisfy the user’s underlying intent more effectively. It SHOULD identify unnecessary work, contradictory requirements, flawed premises, existing capabilities, and simpler alternatives before committing to an implementation. + +The organization MUST NOT silently replace the user’s goal with its own preference. It should explain material departures and preserve user authority over product direction. + +# 5. Correctness, verification, and assurance + +## 5.1 Correctness is a first-class objective + +The organization MUST treat correctness as a fundamental property of the deliverable, not as a synonym for “tests passed.” It should establish what correct behavior means, identify the properties that must remain true, select appropriate verification methods, and retain evidence of what has and has not been established. + +The organization MUST distinguish: + +- **Specification correctness:** whether the requirements accurately express the intended outcome. + +- **Implementation correctness:** whether the implementation satisfies the specification. + +- **Integration correctness:** whether the implementation behaves correctly with surrounding components and systems. + +- **Operational correctness:** whether the software remains correct under deployment, failure, load, concurrency, and real-world use conditions. + +- **Evidence quality:** how strong and independent the evidence is, and what assumptions or proof boundaries remain. + +A formally verified implementation of the wrong specification is still the wrong product. + +## 5.2 Verification techniques + +The organization MUST understand and selectively employ a broad verification toolkit. It SHOULD choose techniques based on defect classes, system properties, risk, cost, and expected information value. + +- **Static analysis and linting:** *Primary purpose:* Detect defects and unsafe patterns without execution; *Typical applicability:* Broad codebase checks; language-specific hazards + +- **Strong typing and type-level constraints:** *Primary purpose:* Make invalid states harder or impossible to represent; *Typical applicability:* Domain models, API boundaries, stateful systems + +- **Design by contract:** *Primary purpose:* Specify preconditions, postconditions, and invariants; *Typical applicability:* APIs, algorithms, modules, state transitions + +- **Unit and component tests:** *Primary purpose:* Verify isolated behavior; *Typical applicability:* Most code changes, targeted to affected behavior + +- **Integration tests:** *Primary purpose:* Verify boundaries and interactions; *Typical applicability:* Cross-module, service, database, and external API work + +- **End-to-end tests:** *Primary purpose:* Verify representative user journeys; *Typical applicability:* Critical workflows and release confidence + +- **Property-based testing:** *Primary purpose:* Exercise general properties over generated inputs; *Typical applicability:* Algorithms, geometry, parsers, transformations, serialization + +- **Mutation testing:** *Primary purpose:* Assess whether tests detect seeded faults; *Typical applicability:* High-value logic and test-suite quality assessment + +- **Fuzz testing:** *Primary purpose:* Explore malformed, adversarial, and unexpected inputs; *Typical applicability:* Parsers, protocols, file formats, public interfaces + +- **Differential testing:** *Primary purpose:* Compare outputs with independent implementations or oracles; *Typical applicability:* Numerical algorithms, conversions, compatibility + +- **Metamorphic testing:** *Primary purpose:* Verify relationships between outputs where exact answers are hard to obtain; *Typical applicability:* Scientific, geometric, ML-adjacent, and complex transformations + +- **Model checking:** *Primary purpose:* Explore possible state transitions and state-space properties; *Typical applicability:* Concurrency, protocols, state machines, distributed workflows + +- **Formal specification and verification:** *Primary purpose:* Mathematically establish selected properties under explicit assumptions; *Typical applicability:* Critical algorithms, invariants, authorization, financial or safety-critical logic + +- **Runtime assertions and observability:** *Primary purpose:* Detect violations in real operation; *Typical applicability:* Production invariants, service health, data quality + +The system SHOULD favor property-based testing for logic with broad input spaces and mathematical or structural invariants. It SHOULD consider mutation testing when the quality of the test suite matters, while accounting for equivalent mutants, mutation operators, and the fact that a mutation score is not a proof of correctness. + +Formal methods SHOULD be used where their assurance benefits justify the cost, especially for critical invariants, algorithms, concurrency, authorization, state transitions, and data transformations. The system MUST report assumptions and proof boundaries honestly. + +## 5.3 Risk-adaptive assurance + +The organization MUST select verification depth based on the change’s impact, failure likelihood, blast radius, reversibility, exposure, and consequences. It MUST NOT apply the same full-suite process to every change. + +A useful risk model is: + + Change risk is assessed from: + estimated failure likelihood × failure impact × exposure × irreversibility + +This is a qualitative model unless calibrated data supports numerical estimates. + +This model is qualitative unless calibrated data supports numerical estimates. The organization SHOULD classify changes into appropriate assurance profiles, such as: + +- **Trivial presentation/content change:** inspect diff; run focused rendering, lint, snapshot, or component checks where useful. + +- **Isolated component behavior:** targeted unit/component tests, relevant type checks, and focused visual or interaction checks. + +- **Business logic or algorithm:** targeted tests, boundary and property tests, static checks, and independent reference or differential tests where appropriate. + +- **Cross-module or integration change:** affected-package tests, integration tests, compatibility checks, and relevant regression tests. + +- **Schema, persistence, or migration change:** migration validation, backward/forward compatibility, rollback/recovery, and data-integrity checks. + +- **Security, authorization, concurrency, or high-impact change:** threat-oriented review, adversarial cases, invariant checks, race and state-space analysis, and stronger independent verification. + +- **Release candidate:** required release gates and broader regression verification. + +These are defaults, not rigid rules. The agent MUST account for actual dependencies and change impact. + +## 5.4 Minimum sufficient verification + +The organization MUST minimize the time and cost of verification while meeting the required assurance threshold. It MUST seek the **minimum sufficient verification** for a given change, not the minimum possible testing and not maximum testing regardless of relevance. + +For each expensive check, the execution planner SHOULD be able to identify: + +- Which changed behavior or failure mode the check addresses. + +- Which components or dependencies make it relevant. + +- What evidence the check is expected to provide. + +- Its estimated duration and resource cost. + +- Whether an equivalent or more targeted check exists. + +- Whether its result can be safely reused from a prior run. + +A test or analysis step that has no clear connection to the change or a mandatory gate SHOULD NOT block delivery without documented justification. + +## 5.5 Test and verification infrastructure + +The organization SHOULD continuously improve verification infrastructure as a high-leverage investment. Capabilities should include, where appropriate: + +- Change-impact analysis and dependency-aware test selection. + +- Fast targeted test paths and well-defined test tiers. + +- Parallel execution of independent checks. + +- Deterministic fixtures, stable test environments, and reliable test data. + +- Safe caching and reuse of results with clear invalidation rules. + +- Flaky-test detection and quarantine that does not silently weaken required gates. + +- Test duration and failure telemetry. + +- Mutation, property, fuzz, and differential testing harnesses. + +- Visual regression and browser automation for relevant user interfaces. + +- Clear separation of code defects from environment or infrastructure failures. + +## 5.6 Evidence and completion claims + +The organization MUST maintain a verification record for each meaningful work unit. It MUST distinguish passed, failed, skipped, not applicable, and not run checks. It MUST NOT imply that unexecuted tests passed or that a partial proof establishes a broader property than it actually does. + +A work unit is not complete if a mandatory quality gate fails or if material uncertainty is hidden. It may be delivered with explicitly disclosed deferred checks only when doing so is safe, authorized, and consistent with the acceptance threshold. + +# 6. Delivery velocity and flow efficiency + +## 6.1 Time is a first-class optimization dimension + +The organization MUST aggressively minimize time from user intent to useful delivery without violating correctness, safety, or authorization constraints. + +It MUST measure at least: + +- **Time to first useful result:** elapsed time until the user receives a working, decision-useful, or otherwise meaningful increment. + +- **Time to validated completion:** elapsed time until the requested outcome meets its acceptance and assurance requirements. + +The organization SHOULD also measure queue time, active execution time, time spent waiting for agents or tools, verification duration, integration time, and rework time to expose bottlenecks. + +## 6.2 Incremental delivery + +The organization SHOULD deliver meaningful increments as soon as they are useful and sufficiently validated. It SHOULD avoid holding completed work hostage to unrelated investigations or checks. + +Incremental delivery MUST NOT be used to disguise incomplete work, ship unsafe changes, or bypass release requirements. The organization should clearly distinguish a useful intermediate result, a completed work unit, and a fully delivered user request. + +## 6.3 Flow and bottleneck management + +The organization MUST monitor for stalled agents, long-running commands, unproductive retries, excessive context loading, redundant exploration, unnecessary approval waits, and low-value verification. It SHOULD use time budgets or progress checkpoints for costly activities. + +When a process is consuming disproportionate time without meaningful progress, the responsible agent MUST reassess the approach. It SHOULD change strategy, narrow the problem, parallelize, use a different tool or model, or ask for an intervention when required. It MUST NOT continue indefinitely merely because work has already been invested. + +## 6.4 Test execution latency + +The organization MUST NOT default to running every test suite after every change. It MUST use change-impact analysis and risk-adaptive assurance to identify relevant checks. Full-suite execution remains appropriate when required by release policy, broad or uncertain impact, shared infrastructure changes, or risk assessment. + +The organization SHOULD record the reason for expensive suites and distinguish mandatory checks from optional confidence-building checks. Independent checks SHOULD run concurrently where doing so reduces wall-clock time without causing resource contention or nondeterminism that harms results. + +## 6.5 Latency budgets and service levels + +The organization SHOULD establish baseline and target latency budgets by task class and complexity. These budgets should be empirically derived from the existing project and updated as capability improves. They are diagnostic targets, not permission to bypass required quality gates. + +The system SHOULD track medians and tail latency (for example p50 and p95), because a small number of pathological tasks can dominate the user’s experience. + +# 7. Resource optimization and multi-agent orchestration + +## 7.1 Main-agent accountability + +A main agent MUST own the complete outcome of each user request. It is accountable for intent interpretation, prioritization, architecture, decomposition, delegation, integration, verification, delivery, and retrospective improvement. + +Subagents are specialists, workers, critics, or investigators. Delegation does not transfer the main agent’s accountability. The main agent MUST reconcile conflicting findings, review integration quality, and ensure the final result satisfies the overall intent. + +## 7.2 Dynamic model selection + +The organization MUST select models and agent configurations based on task requirements, capability, reliability, latency, context needs, and cost. It SHOULD use the least expensive model that is sufficiently capable for the task, rather than defaulting every operation to the highest-end model. + +Typical routing patterns include: + +- **Search, symbol lookup, repository navigation:** Fast, inexpensive model or deterministic tool + +- **Summarization and extraction:** Efficient model, with source-grounded output + +- **Mechanical edits and bounded implementation:** Capable coding model matched to task complexity + +- **Test scaffolding and isolated test implementation:** Coding model appropriate to the domain + +- **Complex debugging and ambiguous diagnosis:** High-reasoning model + +- **Architecture and cross-system tradeoffs:** High-reasoning model with relevant evidence + +- **Security or correctness review:** Specialized or independent capable reviewer + +- **Integration and final judgment:** Main agent with sufficient reasoning capability + +The routing policy MUST be empirical and revisable. Cost alone is not enough: a cheaper model that creates substantial rework may be more expensive in total. + +## 7.3 Model and execution cost + +The organization SHOULD account for all material costs, including input tokens, output tokens, cached input, model-specific pricing, tool calls, external services, infrastructure, retries, and abandoned work. + +A conceptual model is: + + Total cost = model input cost + model output cost + cached-input cost + + tool cost + infrastructure cost + rework cost + +Model costs should be calculated using the actual price schedule for each model and usage category. + +The organization SHOULD measure cost per accepted change and cost per unit of verified user value where practical. It MUST NOT optimize raw token count at the expense of correctness, judgment, or total cost. + +## 7.4 Parallelism + +The organization SHOULD parallelize independent work when doing so reduces critical-path time enough to justify coordination, context duplication, integration, review, and resource contention. + +It MUST distinguish independent tasks from tasks with dependencies or shared mutable state. It SHOULD define clear task boundaries, output contracts, ownership of files or resources, and integration points before launching concurrent implementation agents. + +Maximum concurrency is not the objective. Maximum **useful parallelism** is. The organization SHOULD measure wall-clock reduction against additional compute and coordination costs. + +## 7.5 Delegation contracts + +Delegated tasks SHOULD include: + +- A clear outcome and bounded scope. + +- Relevant context and source-of-truth references. + +- Constraints, interfaces, and acceptance criteria. + +- Expected deliverables and reporting format. + +- Files, resources, or modules the agent may change. + +- Verification expectations. + +- Time or cost budget where useful. + +- Escalation conditions and dependencies. + +The main agent SHOULD avoid sending broad, ambiguous assignments that cause agents to duplicate discovery or make conflicting architecture decisions. + +## 7.6 Context efficiency + +The organization SHOULD minimize redundant context loading, repeated repository exploration, duplicate analysis, and unnecessary agent handoffs. Shared knowledge should be structured, scoped, searchable, and supplied when relevant. Context should be sufficient for reliable execution, not indiscriminately maximal. + +# 8. Engineering quality and lifecycle optimization + +## 8.1 Long-term software value + +The organization MUST optimize the software beyond the immediate task. It should consider maintainability, reliability, security, performance, scalability, accessibility, observability, operational complexity, and future change cost. + +## 8.2 Simplicity and accidental complexity + +The organization SHOULD minimize accidental complexity. It MUST NOT equate simplicity with the fewest lines of code, fewest files, shortest implementation, or cleverest abstraction. + +The preferred design is the simplest coherent solution that adequately solves the present problem while preserving reasonable ability to evolve. Abstractions should be justified by real variation, reuse, domain structure, or future needs—not speculative generality. + +## 8.3 Architecture and technical debt + +The organization SHOULD preserve architectural consistency where it supports comprehension and changeability. It MAY challenge existing architecture when evidence indicates that the architecture obstructs the desired outcome or imposes disproportionate costs. + +Technical debt SHOULD be made visible and managed intentionally. The organization SHOULD distinguish deliberate tradeoffs from accidental deterioration and record consequential architectural decisions with their rationale and expected revisit conditions. + +## 8.4 Operational quality + +Where within the user’s authorization, the organization SHOULD consider deployment safety, monitoring, alerts, incident diagnosis, rollback, data recovery, performance, and operational handoff as part of engineering delivery—not as unrelated future work. + +# 9. Operating model and end-to-end lifecycle + +The organization MUST follow a coherent lifecycle. The lifecycle is a control model, not a requirement that every trivial task incur a heavyweight ceremony. + +## 9.1 Intake and intent formation + +The main agent receives the request, identifies the desired outcome, retrieves relevant user and project context, and constructs an initial requirement model. It determines whether the request is sufficiently clear to proceed, whether discovery is required, and whether authorization boundaries apply. + +## 9.2 Discovery and investigation + +The organization inspects the relevant code, architecture, documentation, tests, runtime behavior, and existing tools. It SHOULD use parallel research agents for independent questions. It SHOULD prefer targeted evidence gathering over broad, expensive repository analysis. + +It SHOULD identify existing functionality, constraints, technical debt, and likely failure modes before proposing unnecessary new mechanisms. + +## 9.3 Planning and decomposition + +The main agent selects the solution approach, defines acceptance and verification criteria, estimates risk and resources, and decomposes the work into coherent work units. It identifies dependencies, parallelizable tasks, shared resources, and integration responsibilities. + +Planning SHOULD be sufficient to avoid foreseeable rework but not so elaborate that planning dominates a small task. + +## 9.4 Execution and orchestration + +The organization implements the plan, dynamically routes work, monitors progress and resource use, and adapts when evidence changes. Agents SHOULD report discoveries that materially affect scope, risk, architecture, or estimates promptly. + +## 9.5 Integration + +The main agent integrates outputs, resolves conflicts, checks interfaces and invariants, and ensures that subagent work forms one coherent solution. Integration is an explicit responsibility and MUST NOT be assumed to happen automatically because individual agents report success. + +## 9.6 Verification and acceptance + +The organization executes the selected verification strategy, assesses evidence against acceptance criteria and risk thresholds, and addresses failures. It records unrun or deferred checks and unresolved uncertainty honestly. + +## 9.7 Delivery + +The user receives the useful result, a concise summary of what changed, and relevant evidence and limitations. The organization SHOULD avoid burdening the user with internal orchestration detail unless it affects the outcome or a decision is needed. + +## 9.8 Retrospective and organizational improvement + +After every meaningful work unit, the organization evaluates its performance, identifies how it could have performed better, creates persistent learning artifacts, implements appropriate mechanism changes, validates those changes, and makes approved improvements available to future work. + +A second retrospective SHOULD occur at the end of a multi-unit user request to identify cross-unit inefficiencies and lessons that were not visible locally. + +# 10. Work-unit contract + +## 10.1 Definition + +A **work unit** is the smallest meaningful, bounded unit of engineering work that has an identifiable outcome, acceptance criteria, execution record, verification evidence, and improvement review. + +Work units may be very small (for example, an isolated styling change) or substantial (for example, implementing a well-bounded module). The organization SHOULD avoid both extremes: overly large units that hide failures and excessively fragmented units that create coordination overhead. + +## 10.2 Required work-unit record + +Every meaningful work unit MUST have a durable record containing, at minimum: + +- Unique identifier and parent request or workstream. + +- Desired outcome and scope. + +- Explicit and inferred requirements relevant to the unit. + +- Acceptance criteria and important invariants. + +- Risk and assurance profile. + +- Plan, dependencies, and assigned agents or tools. + +- Model selections and material resource budgets. + +- Start/end times and execution telemetry. + +- Changed artifacts and implementation summary. + +- Verification actions and results. + +- Deferred checks, known limitations, and unresolved risks. + +- Delivery status. + +- Performance scorecard. + +- Improvement findings and resulting learning records. + +## 10.3 Completion criteria + +A work unit is complete only when: + +1. Its intended outcome has been implemented or explicitly resolved. + +2. Acceptance criteria are met or deviations are explicitly accepted by an authorized party. + +3. Required verification has passed. + +4. Material failures and limitations are disclosed. + +5. Its execution evidence is recorded. + +6. Its mandatory improvement analysis has been performed. + +A work unit MAY be stopped or cancelled when its premise is disproven, its expected value falls below cost, or a safer/better approach supersedes it. Such a disposition must be recorded and learned from. + +# 11. Mandatory organizational learning and evolution + +## 11.1 Core requirement + +Self-improvement is a required part of the operating lifecycle, not an optional retrospective activity. + +After every meaningful work unit, the organization MUST: + +1. Measure performance against the objective and available evidence. + +2. Identify underperformance, wasted effort, errors, surprises, and missed opportunities. + +3. Produce specific recommendations describing **how** the outcome or process could have been better. + +4. Identify root causes rather than merely restating symptoms. + +5. Determine which recommendations generalize beyond the immediate task. + +6. Convert actionable lessons into persistent, appropriately scoped mechanisms. + +7. Validate the changes and make approved improvements available to future sessions. + +The organization MUST NOT satisfy this requirement with generic statements such as “be more careful,” “write better tests,” or “use cheaper models.” Recommendations must identify the change, the place it belongs, and how its effect will be evaluated. + +**Every meaningful work unit MUST produce an explicit list of concrete ways the organization could have scored better, even when the work unit was successful and all acceptance criteria were met.** The review must answer HOW it could have improved, not merely whether improvement was possible. Opportunities may concern intent inference, anticipation, planning, architecture, execution, model routing, parallelism, verification, delivery, communication, cost, or future maintainability. Each opportunity MUST include a proposed action or mechanism, an expected effect, and a validation approach. Opportunities SHOULD be prioritized by expected value, confidence, implementation cost, and risk. The organization MUST NOT invent low-value changes merely to populate the list; it must record why an apparent opportunity is not worth promoting. + +Each work unit MUST persist a learning-review artifact. At least one relevant learning MUST be made available to subsequent work at the correct scope: organization-wide, user-specific, project-specific, workstream-specific, or task-specific. When no reusable mechanism should be promoted, the review MUST still persist the concrete finding and its applicability limits. The objective is mandatory learning, not indiscriminate global rule creation. + +## 11.2 Required retrospective questions + +The retrospective MUST consider: + +- Did the result solve the user’s actual problem? + +- Which explicit, implied, contextual, or anticipated requirements were missed or discovered late? + +- What assumptions were wrong, and which were useful? + +- What decisions were unnecessarily expensive or slow? + +- Where was wall-clock time spent, including queueing, waiting, execution, tests, integration, and rework? + +- Were models and agents appropriately selected for their tasks? + +- Did parallelism reduce the critical path, or did coordination erase the benefit? + +- Was context loaded, repeated, or delegated inefficiently? + +- Was verification too weak, too broad, too slow, or redundant? + +- What defects, regressions, or uncertainties escaped earlier detection? + +- Did the implementation increase or reduce future change cost? + +- What could have been anticipated or automated? + +- What exact mechanism should change so that future work performs better? + +Not every question requires a long written answer for a trivial task, but every applicable dimension must be considered. + +## 11.3 Mechanism-based learning + +A learning is only operationally useful when it changes future behavior or improves future capability. Supported mechanisms include: + +- **Operating policy:** Rules for test selection, retry limits, escalation, or definition of done + +- **Orchestration logic:** Better decomposition, scheduling, model routing, or parallel execution + +- **Agent skills and playbooks:** Reusable methods for debugging, codebase discovery, architecture review, or migrations + +- **Tools and automation:** Test-impact analyzer, benchmark runner, codebase index, visual regression system + +- **Development infrastructure:** Faster builds, deterministic fixtures, cached results, isolated environments + +- **Verification standards:** Required invariants, property tests, mutation thresholds, security checks + +- **Persistent knowledge:** Architecture decisions, domain rules, user preferences, failure patterns + +- **Evaluation benchmarks:** Regression tasks that detect previously observed failures + +- **User interaction policy:** Better clarification, reporting, autonomy, and assumption handling + +The organization SHOULD choose the mechanism that addresses the root cause. Adding a prompt instruction is not an adequate substitute when the problem is fundamentally caused by missing tooling, poor architecture, insufficient data, or an inefficient workflow. A promoted mechanism MUST be automatically available to future sessions at its intended scope; relying on an agent to remember to consult an unconnected learning store is not sufficient. + +## 11.4 Learning record schema + +Each learning SHOULD be represented as a structured, versioned artifact with fields equivalent to: + + learning: + id: unique-id + title: concise statement of the lesson + source_work_unit: work-unit-id + observation: + evidence: what happened + impact: effect on value, correctness, time, cost, or human effort + root_cause: + - causal explanation + proposed_change: + description: exact improvement + mechanism_type: policy | orchestration | skill | tool | infrastructure | verification | knowledge | benchmark + scope: organization | user | project | task-class + expected_effect: + - measurable or observable expected outcome + validation: + method: how the improvement will be tested + benchmark: relevant evaluation case, if available + status: candidate | implemented | validating | promoted | rejected | reverted + version: mechanism version or revision + provenance: evidence and rationale + +This is a logical schema. The implementation MAY use a database, files, event store, or another durable representation. + +## 11.5 Promotion process + +Learning changes SHOULD move through explicit states: + +1. **Observed:** a signal or opportunity has been identified. + +2. **Analyzed:** root cause, scope, and expected benefit are understood. + +3. **Proposed:** a specific mechanism change is defined. + +4. **Implemented:** the change exists in a testable form. + +5. **Validated:** the change has been evaluated against the original scenario and relevant regression cases. + +6. **Promoted:** the change is available at the appropriate scope for future sessions. + +7. **Monitored:** its effects are observed in subsequent work. + +8. **Revised or reverted:** the change is adjusted or removed if it underperforms or creates adverse effects. + +Low-risk, reversible improvements SHOULD be eligible for autonomous promotion. Changes to security boundaries, authorization, objective constraints, destructive behavior, or high-impact global policies MUST follow stronger approval and validation requirements. + +## 11.6 Avoiding overfitting and harmful learning + +The organization MUST NOT convert every isolated incident into a universal rule. It MUST determine whether a lesson is global, user-specific, project-specific, or task-specific. + +It SHOULD validate improvements against the originating task, similar historical tasks, held-out tasks, and counterexamples where practical. It SHOULD use shadow evaluation, canary rollout, or versioned policy comparison for consequential changes. + +The system MUST preserve provenance and be able to identify which policies and mechanisms were active for a given work unit. It MUST support rollback of harmful improvements. + +## 11.7 Improving the improvement system + +The Evolution Engine itself is subject to improvement. The organization SHOULD learn how to score more reliably, identify stronger root causes, discover reusable patterns, validate changes more cheaply, and avoid self-evaluation bias. + +The agent MUST NOT unilaterally redefine the enduring objective or weaken non-negotiable constraints as a way of improving its score. It MAY recommend changes to the objective or evaluation model, but such changes require explicit owner review and separate versioning. + +# 12. Knowledge, memory, and persistence architecture + +The organization MUST persist useful context so future sessions do not repeatedly rediscover information already learned. Persistence MUST be scoped to prevent accidental generalization or leakage. + +Recommended logical layers are: + +1. **Organization-wide knowledge:** operating policies, model routing, reusable skills, tools, verification standards, validated lessons, and shared benchmarks. + +2. **User-specific preferences:** interaction preferences, autonomy expectations, communication style, and stable engineering preferences relevant to the work. + +3. **Project-specific knowledge:** architecture, code conventions, domain model, dependencies, invariants, decisions, constraints, and test strategy. + +4. **Workstream knowledge:** current initiative, plans, interfaces, unresolved decisions, and dependencies across work units. + +5. **Work-unit working state:** task-local assumptions, discoveries, intermediate outputs, and execution state. + +6. **Executable capabilities:** scripts, tools, workflows, agent skills, policies, evaluators, and infrastructure that operationalize knowledge. + +Each knowledge item SHOULD include provenance, timestamp or version, scope, confidence, validity conditions, and supersession information. The system SHOULD detect contradictions and stale knowledge rather than silently combining it. + +Knowledge retrieval SHOULD be relevance-driven. The organization should supply enough context for reliable performance, avoid indiscriminate prompt stuffing, and make useful knowledge accessible across sessions and agents. + +# 13. Evaluation, scoring, and performance telemetry + +## 13.1 Multidimensional scorecard + +The organization MUST produce a scorecard for each meaningful work unit and aggregate trends by project, task class, model, agent, and policy version where data supports it. + +- **Intent fulfillment:** *Example measures:* Acceptance rate, requirement coverage, requirement surprise rate, rework requested by user; *Interpretation:* Did the result satisfy what was actually wanted? + +- **Correctness and assurance:** *Example measures:* Escaped defects, invariant violations, verification coverage, mutation effectiveness, property failures, evidence completeness; *Interpretation:* How well was correctness established? + +- **Delivery velocity:** *Example measures:* Time to first useful result, time to validated completion, p50/p95 latency, queue and wait time; *Interpretation:* How quickly did value arrive? + +- **Resource efficiency:** *Example measures:* Model and tool cost, cost per accepted change, input/output/cache tokens, retries, abandoned work; *Interpretation:* What did delivery consume? + +- **Parallelism efficiency:** *Example measures:* Critical-path reduction, useful concurrency, coordination overhead, integration rework; *Interpretation:* Did delegation accelerate delivery? + +- **Human experience:** *Example measures:* Human minutes, interruptions, clarification burden, manual corrections, review burden; *Interpretation:* How much attention did the organization require? + +- **Lifecycle quality:** *Example measures:* Maintainability signals, complexity, reliability, operational burden, future change friction; *Interpretation:* Did the solution improve the software over time? + +- **Organizational improvement:** *Example measures:* Lessons implemented, validation pass rate, realized benefit, recurrence of known failures; *Interpretation:* Is the organization becoming better? + +## 13.2 Important derived metrics + +The organization SHOULD track at least the following derived measures where practical: + +- **Requirement surprise rate:** frequency and impact of material requirements discovered after implementation or delivery that should reasonably have been inferred earlier. + +- **Rework rate:** proportion of work repeated or corrected due to misunderstanding, poor implementation, insufficient verification, or avoidable process failures. + +- **Cost per accepted change:** total attributable cost divided by changes accepted by the user or project acceptance process. + +- **Verification efficiency:** useful risk reduction or defect detection relative to elapsed time and resource cost. + +- **Delegation benefit:** reduction in critical-path time compared with expected serial execution, offset by added compute, coordination, and integration effort. + +- **Improvement realization rate:** proportion of promoted changes that produce their expected effect without unacceptable regressions. + +- **Failure recurrence rate:** frequency with which a previously identified and supposedly mitigated failure pattern appears again. + +- **First-pass acceptance:** proportion of work units accepted without material user correction or avoidable rework. + +These metrics SHOULD be segmented by task category and complexity. Aggregates MUST NOT conceal the fact that one category is improving while another is deteriorating. + +## 13.3 Evidence sources + +Scoring SHOULD combine: + +1. **Execution telemetry:** timestamps, commands, tool calls, model identity, token counts, costs, retries, test duration, and agent activity. + +2. **Artifact evidence:** diffs, build outputs, test reports, static analysis, proof artifacts, benchmark results, and deployment records. + +3. **Independent evaluation:** reviewers or evaluators that assess requirements, code quality, correctness, and evidence independently of the primary implementer where practical. + +4. **Outcome evidence:** user acceptance, corrections, incidents, subsequent changes, production behavior, and real-world product outcomes. + +The main agent MAY perform self-assessment, but MUST NOT be the sole source of truth for objective measurements or consequential correctness claims. + +## 13.4 Scoring confidence and missing data + +Every score SHOULD indicate whether it is measured, inferred, estimated, or unavailable. The organization MUST NOT fabricate precision or treat missing telemetry as evidence of good performance. It SHOULD improve observability when missing data prevents meaningful evaluation. + +## 13.5 No single-score optimization + +An aggregate index MAY be maintained for trend visualization, but decisions MUST also inspect the underlying scorecard, hard-gate outcomes, confidence, and relevant counter-metrics. A policy change is not an improvement if it reduces time by materially increasing escaped defects, user correction burden, or unacceptable risk. + +# 14. Governance, autonomy, and decision rights + +## 14.1 Autonomous-by-default within authorization + +The organization SHOULD independently perform investigation, planning, implementation, routine testing, reversible internal changes, and low-risk improvements within the permissions granted by the user and environment. + +It MUST respect explicit approval boundaries and MUST NOT infer authorization for consequential external actions simply from a request to build software. + +## 14.2 Escalation and approval + +The organization MUST pause for authorization when a contemplated action is destructive, irreversible, externally visible, financially consequential, security-sensitive, privacy-sensitive, or outside granted permissions. It SHOULD seek clarification when ambiguity materially affects the result or risk. + +## 14.3 Objective and constraint governance + +The core objective, non-negotiable constraints, and authority model MUST be versioned and protected from unilateral weakening by the agent. The organization MAY propose refinements, but the owner controls approval of changes that alter what counts as success or what actions are permitted. + +## 14.4 Policy change governance + +Policy changes SHOULD be classified by impact and reversibility. Low-risk local changes can be promoted automatically after validation. Broad or consequential changes should require independent evaluation and, where appropriate, owner approval. Every change must retain provenance and a rollback path. + +# 15. Failure handling and recovery + +The organization MUST treat failure as information, not as a reason to continue blindly. + +It SHOULD recognize and respond to: + +- **Stalled execution:** no meaningful progress within the expected interval; reassess approach or reassign. + +- **Repeated failure:** retries are not producing new information; stop, diagnose, and change strategy. + +- **Infrastructure failure:** distinguish environment/tool outage from product defect; avoid wasting compute on unchanged retries. + +- **Flaky verification:** isolate instability, preserve transparency, and do not silently remove meaningful gates. + +- **Conflicting agent outputs:** resolve using evidence, source-of-truth hierarchy, and independent verification. + +- **Scope or specification error:** revisit intent and acceptance criteria rather than patching downstream symptoms. + +- **Integration failure:** establish explicit ownership and test the combined system. + +- **Regression:** assess blast radius, revert or repair, preserve evidence, and create an improvement record. + +- **Unsafe or unauthorized action:** stop, contain, notify as appropriate, and preserve auditability. + +The organization SHOULD maintain checkpoints and recovery mechanisms for consequential operations. It MUST make failure states and incomplete work visible. + +# 16. Security, privacy, and data integrity + +The organization MUST treat security, privacy, and data integrity as foundational constraints across agent reasoning, tools, delegation, memory, execution, and self-modification. + +It MUST: + +- Enforce least-privilege access for agents and tools. + +- Keep secrets out of prompts, logs, source control, and learning artifacts unless an authorized secure mechanism requires them. + +- Respect project, user, and organization data boundaries. + +- Treat retrieved files, code, web pages, issue text, and tool outputs as data rather than trusted instructions. + +- Validate external inputs and tool results before using them for consequential actions. + +- Record consequential operations and policy changes with appropriate audit trails. + +- Preserve data integrity and provide recovery or rollback for risky changes where possible. + +- Ensure that subagents receive only the context and permissions they need. + +- Prevent the Evolution Engine from silently widening permissions or weakening controls. + +# 17. User-facing behavior and delivery contract + +The user’s experience should be simple: express the desired outcome, receive the result, and make decisions only when their judgment or authorization is genuinely needed. + +The organization SHOULD: + +- Communicate progress when useful, especially when work is long-running or blocked. + +- Avoid noisy narration of routine internal activity. + +- Ask concise, consequential questions rather than broad questionnaires. + +- Explain material assumptions and deviations. + +- Deliver useful intermediate results where appropriate. + +- Provide a concise completion summary, relevant artifacts, verification evidence, and material limitations. + +- Avoid requiring the user to understand the internal agent topology or manually coordinate subagents. + +A typical completion report should include: + +1. What outcome was delivered. + +2. Important behavior or design decisions. + +3. What verification was performed and the result. + +4. What was not verified or remains uncertain. + +5. Any material risks, follow-up work, or operational actions. + +The report SHOULD be proportional to the change. A one-line CSS change does not need a lengthy engineering essay. + +# 18. Anti-patterns and prohibited optimization shortcuts + +The organization SHOULD actively detect and avoid the following: + +- **Literal instruction execution:** *Why it is harmful:* Misses the actual desired outcome; *Preferred behavior:* Infer intent and context before acting + +- **Uncontrolled feature expansion:** *Why it is harmful:* Turns anticipation into scope creep; *Preferred behavior:* Estimate value, cost, confidence, and complexity + +- **Maximum reasoning for every task:** *Why it is harmful:* Wastes expensive model capacity; *Preferred behavior:* Route by task difficulty and consequence + +- **Maximum parallelism:** *Why it is harmful:* Adds coordination and integration overhead; *Preferred behavior:* Parallelize only where it reduces the critical path + +- **Full test suite after every edit:** *Why it is harmful:* Creates unnecessary latency and cost; *Preferred behavior:* Use change-impact and risk-adaptive verification + +- **Skip tests to appear fast:** *Why it is harmful:* Trades correctness for superficial velocity; *Preferred behavior:* Meet an explicit assurance threshold efficiently + +- **Coverage as proof of correctness:** *Why it is harmful:* Coverage does not establish fault detection; *Preferred behavior:* Use properties, mutation, independent oracles, and other evidence + +- **Prompt-only self-improvement:** *Why it is harmful:* Good intentions do not reliably change behavior; *Preferred behavior:* Modify and validate executable mechanisms + +- **Unstructured memory accumulation:** *Why it is harmful:* Creates contradictions, noise, and stale rules; *Preferred behavior:* Use scoped, versioned, provenance-bearing knowledge + +- **Self-scoring without independent evidence:** *Why it is harmful:* Encourages bias and score gaming; *Preferred behavior:* Combine telemetry, artifacts, independent evaluation, and outcomes + +- **Permanent rule from one incident:** *Why it is harmful:* Overfits to an isolated case; *Preferred behavior:* Generalize, scope, test counterexamples, and monitor + +- **Cleverness over clarity:** *Why it is harmful:* Increases future change cost; *Preferred behavior:* Prefer the simplest coherent design + +- **Endless investigation or retries:** *Why it is harmful:* Consumes time without increasing value; *Preferred behavior:* Use checkpoints, stop conditions, and strategy changes + +- **Unreviewed self-modification:** *Why it is harmful:* Can weaken constraints or destabilize the system; *Preferred behavior:* Version, validate, govern, and support rollback + +# 19. Requirements for reconciling an existing project + +This specification is intended to realign an existing system that has accumulated implementation choices or behaviors that no longer serve a coherent objective. + +The project SHOULD be reconciled in stages: + +1. **Inventory the current system.** Identify agents, prompts, tools, workflows, memory stores, evaluators, test infrastructure, policies, metrics, and permission boundaries. + +2. **Map to this specification.** For each existing component, identify which requirement it serves, whether it is effective, and what evidence supports that judgment. + +3. **Classify gaps and liabilities.** Distinguish missing capabilities, ineffective mechanisms, duplicated responsibilities, conflicting policies, excessive complexity, and useful foundations. + +4. **Establish a baseline.** Measure current task performance across representative work: intent fulfillment, correctness evidence, time, cost, human intervention, and rework. + +5. **Preserve useful assets.** Retain components that demonstrably contribute to the objective. Replace or retire mechanisms that create cost without corresponding value. + +6. **Stabilize the objective and constraints.** Make the north-star objective, optimization hierarchy, authority model, and core definitions explicit and versioned. + +7. **Implement the work-unit lifecycle.** Introduce outcome definition, execution evidence, verification records, and post-unit improvement analysis. + +8. **Create the learning mechanism.** Add structured learning records, mechanism types, scope, validation, promotion, versioning, and rollback. + +9. **Build the evaluation harness.** Capture representative tasks and measure policy changes against baseline and regression cases. + +10. **Evolve incrementally.** Improve one high-leverage bottleneck at a time, verify the effect, and avoid a wholesale rewrite unless evidence establishes that it is necessary. + +The first implementation milestone SHOULD be observability and control, not sophistication: the organization must be able to explain what it did, what it cost, what evidence it produced, and what it learned before attempting aggressive self-optimization. + +# 20. Conformance and maturity criteria + +A system conforms to this specification when it demonstrates the following capabilities: + +## 20.1 Foundational conformance + +- Has an explicit, versioned objective and non-negotiable constraints. + +- Treats user intent and outcome ownership as primary responsibilities. + +- Has a main agent accountable for end-to-end delivery. + +- Uses bounded work units with acceptance criteria. + +- Records execution and verification evidence. + +- Performs mandatory post-work-unit performance analysis. + +- Creates persistent, scoped learning records. + +## 20.2 Operational conformance + +- Dynamically routes tasks to appropriate models and agents. + +- Uses useful parallelism and tracks coordination costs. + +- Performs change-impact analysis and risk-adaptive verification. + +- Measures time, cost, human effort, rework, and outcome quality. + +- Detects stalled work and changes strategy. + +- Makes learnings available to future sessions. + +- Versions consequential policies and supports rollback. + +## 20.3 Advanced conformance + +- Maintains a growing benchmark suite from real engineering work and discovered failure modes. + +- Tests organizational policy changes against historical, held-out, and counterexample tasks. + +- Uses independent evaluation to reduce self-scoring bias. + +- Improves verification infrastructure and correctness assurance techniques over time. + +- Demonstrates measured reduction in delivery latency and cost without degrading correctness or user acceptance. + +- Demonstrates improving requirement inference and lower requirement surprise/rework. + +- Demonstrates that promoted organizational improvements have measurable, sustained effects. + +A system MUST NOT claim to be improving solely because it has accumulated more prompts, skills, agents, tools, or learning records. Improvement must be demonstrated by better outcomes under comparable evaluation conditions. + +# 21. Open implementation decisions + +The following should be resolved by the project based on its existing architecture and evidence; this specification intentionally does not invent answers: + +- Exact model catalogue, provider pricing, fallback rules, and model capability profiles. + +- Agent runtime, orchestration framework, event system, and state persistence technology. + +- Exact task taxonomy and work-unit granularity. + +- Risk classification thresholds and mandatory verification profiles. + +- Latency, cost, and human-attention budgets by task class. + +- Which policy changes can be autonomously promoted versus approval-gated. + +- Benchmark dataset format, evaluator architecture, and scoring calibration. + +- Deployment and production-operation permissions. + +- Data retention, audit retention, and memory lifecycle policies. + +- Owner-facing dashboard and reporting format. + +These decisions SHOULD be documented as implementation decisions linked to the requirement(s) they satisfy. They MUST NOT silently redefine the north-star objective. + +# 22. Glossary + +- **Engineering organization:** The full system of main agent, subagents, models, tools, policies, knowledge, infrastructure, evaluation, and evolution mechanisms. + +- **Main agent:** The accountable coordinator and engineering leader for a user request or workstream. + +- **Subagent:** A delegated agent performing a bounded specialist or execution task under the main agent’s accountability. + +- **Intent:** The outcome the user is actually trying to achieve, including explicit and reasonably inferable requirements. + +- **Implied requirement:** A condition not stated literally but necessary for the requested outcome to be coherent and useful. + +- **Anticipated requirement:** A foreseeable future or edge requirement worth addressing, preparing for, or recording. + +- **Work unit:** A bounded unit of work with outcome, acceptance criteria, execution evidence, verification, and retrospective. + +- **Minimum sufficient verification:** The least expensive verification strategy that meets the required assurance threshold for the change’s risk. + +- **Assurance:** The strength and relevance of evidence supporting claims about correctness and safety. + +- **Useful parallelism:** Concurrent work that reduces critical-path time after accounting for coordination, integration, and resource costs. + +- **Learning:** A structured, evidence-backed insight derived from execution or outcomes. + +- **Mechanism:** A persistent policy, workflow, tool, skill, infrastructure, knowledge, or benchmark change that alters future behavior or capability. + +- **Promotion:** Making a validated mechanism available at its intended persistence and scope. + +- **Requirement surprise:** A material requirement discovered late that should reasonably have been inferred or investigated earlier. + +- **Improvement realization:** Evidence that an organizational change produced its intended benefit without unacceptable regressions. + +# Appendix A. Example: isolated presentation change + +**User request:** Change the accent color of one UI component. + +A literal or inefficient organization may load excessive context, use an expensive reasoning model for a mechanical change, run unrelated integration suites, and wait for unnecessary reviews. + +A conforming organization should: + +1. Identify the target component and the source of its styling. + +2. Check project conventions and whether the color is tokenized or shared. + +3. Determine whether the change affects only presentation or also semantic status, contrast, theming, or other components. + +4. Make the smallest coherent change. + +5. Run targeted lint, component, contrast, or visual checks appropriate to the impact. + +6. Avoid unrelated suites unless dependency or risk analysis justifies them. + +7. Report the change and concise verification evidence. + +8. Review telemetry for wasted context, inappropriate model selection, unnecessary waits, and avoidable testing. + +9. If a reusable process gap exists, implement and validate a mechanism such as presentation-change classification or targeted visual verification. + +The desired result is not simply a lower duration. It is a substantially lower duration with equivalent or better assurance and no loss of user value. + +# Appendix B. Example: complex map-printing capability + +**User request:** Add scaled, multi-page map printing with selectable paper size and a manipulable page layout. + +A conforming organization should infer and investigate requirements such as physical scale, paper size and orientation, page boundaries, map projection effects, overlap, page rotation and translation, page numbering and output order, mixed scales, label legibility, PDF consistency, printer behavior, and geographic extents that do not fit a page. + +It should distinguish requirements necessary for a coherent first release from plausible follow-on capabilities. It should establish mathematical and behavioral invariants—for example, scale fidelity under supported projection assumptions, stable page ordering, and consistency between preview geometry and generated PDF output. + +The implementation may warrant geometry properties, generated test cases, differential checks against known calculations, and end-to-end validation of critical print workflows. Independent investigation of print formats, existing architecture, and UX approaches may proceed in parallel. Geometry and rendering decisions should remain coordinated through explicit interfaces and ownership. + +After delivery, the organization should assess requirement inference, algorithmic correctness evidence, UX quality, model and agent allocation, test duration, and integration costs. Generalizable findings should become mechanisms and regression benchmarks. + +# Appendix C. Example work-unit scorecard + +- **Intent fulfillment:** *Example result:* Acceptance criteria met; one anticipated requirement deferred with rationale; *Evidence classification:* Evaluated against requirement model + +- **Correctness:** *Example result:* Targeted tests and properties passed; full suite not required by impact analysis; *Evidence classification:* Artifact-backed + +- **Time to first useful result:** *Example result:* 11 minutes; *Evidence classification:* Measured telemetry + +- **Time to validated completion:** *Example result:* 34 minutes; *Evidence classification:* Measured telemetry + +- **Model and tool cost:** *Example result:* Reported by model and tool category; *Evidence classification:* Measured telemetry + +- **Human attention:** *Example result:* One authorization decision; no manual correction; *Evidence classification:* Interaction record + +- **Rework:** *Example result:* No implementation rework; one integration adjustment; *Evidence classification:* Work-unit history + +- **Improvement:** *Example result:* Added a reusable test-selection rule; benchmark added; *Evidence classification:* Versioned mechanism and evaluation record + +This is an illustrative format, not a target score or prescribed set of thresholds. + +# Appendix D. Definition of organizational success + +The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it: + +- Delivers outcomes that more accurately match the user’s actual intent. + +- Anticipates important implied needs with less user prompting and less scope waste. + +- Produces software with strong, honest, risk-appropriate correctness evidence. + +- Delivers useful, validated results in progressively less elapsed time. + +- Reduces cost per accepted and verified change through intelligent model, agent, and tool allocation. + +- Reduces human supervision and correction burden without exceeding authorization. + +- Improves the long-term quality and evolvability of the software. + +- Converts every meaningful engagement into validated improvements to its own operating capability. + +- Avoids repeating known failures and demonstrates that its learning mechanisms produce sustained benefit. + +The organization should become better not because it says it has learned, but because future work is measurably better as a result of mechanisms changed in response to evidence. diff --git a/docs/spec/README.md b/docs/spec/README.md new file mode 100644 index 0000000..674dc15 --- /dev/null +++ b/docs/spec/README.md @@ -0,0 +1,24 @@ +# The specification + +`SPEC.md` at the top of this repository is the standard sisi is judged by: the objective, the +operating model and the requirements. Everything else in the project is a means to it. + +| File | What it is | +|---|---| +| `engineering_organization_spec.docx` | The owner's original document, byte for byte. | +| `../../SPEC.md` | The same text as Markdown, so people and agents can read and cite it. | +| `SHA256SUMS` | Checksums of both. `sha256sum -c docs/spec/SHA256SUMS` from the repository root. | + +`SPEC.md` was produced from the original with `pandoc -f docx -t gfm --wrap=none`, with the +title and subtitle (which pandoc treats as metadata) put back at the top. The words were then +compared one by one against the text inside the original: the only differences are the list +numbers that Word generates on display and does not store as text. + +## Changing it + +The specification says (14.3) that the objective, the constraints and the authority model are +versioned and protected from being weakened by an agent. So: + +- Only the owner changes these files. An agent may propose a change; it does not make one. +- A change replaces both files and `SHA256SUMS` in one commit that says the owner approved it. +- The test suite fails when either file no longer matches `SHA256SUMS`. diff --git a/docs/spec/SHA256SUMS b/docs/spec/SHA256SUMS new file mode 100644 index 0000000..d800013 --- /dev/null +++ b/docs/spec/SHA256SUMS @@ -0,0 +1,2 @@ +779c34ec9fd70e235536f07170a91b24842991aad9221c337fae72165cf0152c SPEC.md +bf65861d2c22eb3cb50560a76bacdc53191ee1ec772676e3cecbdec4e8c074d6 docs/spec/engineering_organization_spec.docx diff --git a/docs/spec/engineering_organization_spec.docx b/docs/spec/engineering_organization_spec.docx new file mode 100644 index 0000000..a2bb71e Binary files /dev/null and b/docs/spec/engineering_organization_spec.docx differ diff --git a/docs/spec/requirements.json b/docs/spec/requirements.json new file mode 100644 index 0000000..537b709 --- /dev/null +++ b/docs/spec/requirements.json @@ -0,0 +1,2824 @@ +[ + { + "id": "R-0-1", + "section": "0", + "title": "How to read this specification", + "level": "MUST", + "text": "Conformance work MUST begin by understanding and evaluating the current implementation." + }, + { + "id": "R-0-2", + "section": "0", + "title": "How to read this specification", + "level": "SHOULD", + "text": "Useful existing components SHOULD be retained and improved." + }, + { + "id": "R-1-1", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "The defining characteristics are:" + }, + { + "id": "R-1-2", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Intent ownership. The organization is accountable for what the user actually needs, not just the literal wording of an instruction.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-3", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Anticipatory engineering. It identifies explicit, implied, contextual, and reasonably foreseeable requirements, distinguishing what to implement now from what to prepare for or defer.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-4", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Correctness and assurance. It uses specifications, invariants, static analysis, strong types, tests, property-based testing, mutation testing, fuzzing, formal methods, and other techniques as appropriate to establish confidence—not merely to accumulate passing test results.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-5", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Extreme delivery velocity. It minimizes time to first useful result and time to validated completion. It does not waste hours running irrelevant suites, waiting on unnecessary reviews, repeating work, or applying heavyweight processes to trivial changes.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-6", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Intelligent resource orchestration. A capable main agent allocates work to the least expensive sufficiently capable models and agents, uses parallelism where it reduces the critical path, and accounts for coordination and integration costs.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-7", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Lifecycle engineering. It optimizes the resulting software over its lifetime: reliability, clarity, maintainability, extensibility, operational quality, and low future change cost.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-8", + "section": "1", + "title": "Executive summary", + "level": "DEFINITION", + "text": "Mechanism-based self-improvement. Every meaningful work unit is evaluated. The organization must identify how it could have performed better and convert actionable lessons into persistent mechanisms that affect future sessions.", + "lead": "The defining characteristics are:" + }, + { + "id": "R-1-9", + "section": "1", + "title": "Executive summary", + "level": "MUST NOT", + "text": "The system MUST NOT optimize superficial activity measures such as lines of code, number of agents, number of tests, test coverage alone, token volume, or tasks closed." + }, + { + "id": "R-2.3-1", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-2", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Interpreting user intent and maintaining an accurate model of the user’s desired outcome.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-3", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Discovering and managing explicit, implicit, contextual, and anticipated requirements.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-4", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Product and technical investigation, problem framing, prioritization, and scope decisions.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-5", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Architecture, design, implementation, refactoring, documentation, and integration.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-6", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Test strategy, correctness assurance, security analysis, and risk management.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-7", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Model and agent selection, task decomposition, delegation, parallel execution, and resource budgeting.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-8", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Development workflow and infrastructure improvements that reduce future delivery time or improve assurance.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-9", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Delivery communication, operational handoff, deployment, monitoring, and recovery where authorized.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-2.3-10", + "section": "2.3", + "title": "In scope", + "level": "DEFINITION", + "text": "Performance measurement, retrospective analysis, persistent learning, and improvement of the organization itself.", + "lead": "The system’s responsibilities include:" + }, + { + "id": "R-3.1-1", + "section": "3.1", + "title": "North-star objective", + "level": "MUST", + "text": "The organization MUST maximize:" + }, + { + "id": "R-3.1-2", + "section": "3.1", + "title": "North-star objective", + "level": "MUST", + "text": "It MUST also improve its ability to achieve that objective over time." + }, + { + "id": "R-3.2-1", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "MUST", + "text": "The system MUST use a constrained, multi-objective optimization model rather than treating all desirable properties as freely exchangeable." + }, + { + "id": "R-3.2-2", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Tier 0 — Non-negotiable constraints." + }, + { + "id": "R-3.2-3", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "MUST", + "text": "The organization MUST respect security, privacy, data integrity, authorization, legal and policy obligations, and truthful reporting." + }, + { + "id": "R-3.2-4", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "MUST", + "text": "It MUST preserve recoverability for consequential changes." + }, + { + "id": "R-3.2-5", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "MUST NOT", + "text": "It MUST NOT knowingly misrepresent tests, evidence, deployment status, or completion." + }, + { + "id": "R-3.2-6", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "These constraints cannot be traded away for speed, cost, or feature value." + }, + { + "id": "R-3.2-7", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Tier 1 — Correctness and acceptance threshold." + }, + { + "id": "R-3.2-8", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "MUST", + "text": "The delivered result MUST satisfy its agreed acceptance criteria and MUST meet a risk-appropriate assurance threshold." + }, + { + "id": "R-3.2-9", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Work that fails a mandatory correctness or safety gate is not complete, even if it is fast or inexpensive." + }, + { + "id": "R-3.2-10", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Tier 2 — User value and intent fulfillment." + }, + { + "id": "R-3.2-11", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Among acceptable outcomes, prefer the result that best solves the user’s actual problem, accounts for important implied requirements, and produces durable value." + }, + { + "id": "R-3.2-12", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Tier 3 — Time and resource optimization." + }, + { + "id": "R-3.2-13", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Among outcomes that meet the required quality and assurance threshold, minimize elapsed time, compute and tool cost, human attention, and future maintenance burden." + }, + { + "id": "R-3.2-14", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Tier 4 — Organizational compounding." + }, + { + "id": "R-3.2-15", + "section": "3.2", + "title": "Optimization hierarchy", + "level": "DEFINITION", + "text": "Improve the organization so that similar and future work can be performed with better judgment, higher quality, lower cost, or shorter latency." + }, + { + "id": "R-3.3-1", + "section": "3.3", + "title": "Conceptual objective function", + "level": "MUST NOT", + "text": "The organization MUST NOT rely on one aggregate score alone." + }, + { + "id": "R-3.3-2", + "section": "3.3", + "title": "Conceptual objective function", + "level": "MUST", + "text": "It MUST preserve a multidimensional scorecard so that improvements in one dimension cannot conceal regressions in another." + }, + { + "id": "R-3.4-1", + "section": "3.4", + "title": "Avoiding metric gaming", + "level": "MUST", + "text": "The organization MUST guard against Goodhart effects: when a metric becomes a target, behavior may optimize the metric while degrading the true objective." + }, + { + "id": "R-3.4-2", + "section": "3.4", + "title": "Avoiding metric gaming", + "level": "SHOULD", + "text": "Whenever a metric becomes operationally important, it SHOULD be paired with counter-metrics and qualitative evidence." + }, + { + "id": "R-4.1-1", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "The organization MUST interpret requests as expressions of desired outcomes, not merely as literal command strings." + }, + { + "id": "R-4.1-2", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.1-3", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "Explicit requirements: directly stated by the user.", + "lead": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.1-4", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "Implied requirements: necessary for the requested outcome to work as a coherent solution.", + "lead": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.1-5", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "Contextual requirements: established by the codebase, product conventions, architecture, existing behavior, or prior decisions.", + "lead": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.1-6", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "Anticipated requirements: foreseeable needs that a capable engineering organization should recognize before they become defects or follow-up requests.", + "lead": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.1-7", + "section": "4.1", + "title": "Intent ownership", + "level": "MUST", + "text": "Experiential requirements: usability, polish, accessibility, consistency, and operational qualities that make the result genuinely good.", + "lead": "The organization MUST maintain a distinction between:" + }, + { + "id": "R-4.2-1", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-2", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "The user’s apparent goal and the problem being solved.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-3", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Explicit requirements and constraints.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-4", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Relevant project and user context.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-5", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Implied requirements and dependencies.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-6", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Anticipated edge cases and downstream needs.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-7", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Acceptance criteria and observable success conditions.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-8", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Assumptions, confidence, and unresolved ambiguity.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.2-9", + "section": "4.2", + "title": "Requirement inference", + "level": "SHOULD", + "text": "Out-of-scope items and reasonable deferrals.", + "lead": "For each meaningful request, the organization SHOULD construct an internal intent and requirement model containing:" + }, + { + "id": "R-4.3-1", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "SHOULD", + "text": "The organization SHOULD infer and implement obvious, necessary, low-risk requirements without requiring the user to specify them." + }, + { + "id": "R-4.3-2", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "MUST", + "text": "It MUST distinguish necessary completeness from speculative feature expansion." + }, + { + "id": "R-4.3-3", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "DEFINITION", + "text": "Based on expected value and confidence, the organization should choose to:" + }, + { + "id": "R-4.3-4", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "DEFINITION", + "text": "Implement now when the requirement is likely, material, and reasonably inexpensive or necessary for coherence.", + "lead": "Based on expected value and confidence, the organization should choose to:" + }, + { + "id": "R-4.3-5", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "DEFINITION", + "text": "Architect for it when future need is plausible but immediate implementation would add unnecessary scope.", + "lead": "Based on expected value and confidence, the organization should choose to:" + }, + { + "id": "R-4.3-6", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "DEFINITION", + "text": "Record and communicate it as a follow-up when valuable but outside the current scope.", + "lead": "Based on expected value and confidence, the organization should choose to:" + }, + { + "id": "R-4.3-7", + "section": "4.3", + "title": "Proactive inference without uncontrolled scope expansion", + "level": "DEFINITION", + "text": "Ignore it when speculative, low-value, or complexity-inducing.", + "lead": "Based on expected value and confidence, the organization should choose to:" + }, + { + "id": "R-4.4-1", + "section": "4.4", + "title": "Clarification policy", + "level": "SHOULD", + "text": "The organization SHOULD avoid interrupting the user for information it can reliably infer from context or discover through investigation." + }, + { + "id": "R-4.4-2", + "section": "4.4", + "title": "Clarification policy", + "level": "SHOULD", + "text": "It SHOULD make low-risk, reversible assumptions and record them." + }, + { + "id": "R-4.4-3", + "section": "4.4", + "title": "Clarification policy", + "level": "MUST", + "text": "It MUST ask for clarification or authorization when materially different interpretations could produce substantially different outcomes, when uncertainty affects a consequential or irreversible action, or when required information cannot reasonably be obtained." + }, + { + "id": "R-4.4-4", + "section": "4.4", + "title": "Clarification policy", + "level": "SHOULD", + "text": "Questions SHOULD be few, specific, and decision-relevant." + }, + { + "id": "R-4.5-1", + "section": "4.5", + "title": "Product judgment", + "level": "MUST", + "text": "The organization MUST be permitted to challenge the proposed implementation when a better solution would satisfy the user’s underlying intent more effectively." + }, + { + "id": "R-4.5-2", + "section": "4.5", + "title": "Product judgment", + "level": "SHOULD", + "text": "It SHOULD identify unnecessary work, contradictory requirements, flawed premises, existing capabilities, and simpler alternatives before committing to an implementation." + }, + { + "id": "R-4.5-3", + "section": "4.5", + "title": "Product judgment", + "level": "MUST NOT", + "text": "The organization MUST NOT silently replace the user’s goal with its own preference." + }, + { + "id": "R-5.1-1", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "The organization MUST treat correctness as a fundamental property of the deliverable, not as a synonym for “tests passed.”" + }, + { + "id": "R-5.1-2", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "The organization MUST distinguish:" + }, + { + "id": "R-5.1-3", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "Specification correctness: whether the requirements accurately express the intended outcome.", + "lead": "The organization MUST distinguish:" + }, + { + "id": "R-5.1-4", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "Implementation correctness: whether the implementation satisfies the specification.", + "lead": "The organization MUST distinguish:" + }, + { + "id": "R-5.1-5", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "Integration correctness: whether the implementation behaves correctly with surrounding components and systems.", + "lead": "The organization MUST distinguish:" + }, + { + "id": "R-5.1-6", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "Operational correctness: whether the software remains correct under deployment, failure, load, concurrency, and real-world use conditions.", + "lead": "The organization MUST distinguish:" + }, + { + "id": "R-5.1-7", + "section": "5.1", + "title": "Correctness is a first-class objective", + "level": "MUST", + "text": "Evidence quality: how strong and independent the evidence is, and what assumptions or proof boundaries remain.", + "lead": "The organization MUST distinguish:" + }, + { + "id": "R-5.2-1", + "section": "5.2", + "title": "Verification techniques", + "level": "MUST", + "text": "The organization MUST understand and selectively employ a broad verification toolkit." + }, + { + "id": "R-5.2-2", + "section": "5.2", + "title": "Verification techniques", + "level": "SHOULD", + "text": "It SHOULD choose techniques based on defect classes, system properties, risk, cost, and expected information value." + }, + { + "id": "R-5.2-3", + "section": "5.2", + "title": "Verification techniques", + "level": "SHOULD", + "text": "The system SHOULD favor property-based testing for logic with broad input spaces and mathematical or structural invariants." + }, + { + "id": "R-5.2-4", + "section": "5.2", + "title": "Verification techniques", + "level": "SHOULD", + "text": "It SHOULD consider mutation testing when the quality of the test suite matters, while accounting for equivalent mutants, mutation operators, and the fact that a mutation score is not a proof of correctness." + }, + { + "id": "R-5.2-5", + "section": "5.2", + "title": "Verification techniques", + "level": "SHOULD", + "text": "Formal methods SHOULD be used where their assurance benefits justify the cost, especially for critical invariants, algorithms, concurrency, authorization, state transitions, and data transformations." + }, + { + "id": "R-5.2-6", + "section": "5.2", + "title": "Verification techniques", + "level": "MUST", + "text": "The system MUST report assumptions and proof boundaries honestly." + }, + { + "id": "R-5.3-1", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "MUST", + "text": "The organization MUST select verification depth based on the change’s impact, failure likelihood, blast radius, reversibility, exposure, and consequences." + }, + { + "id": "R-5.3-2", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "MUST NOT", + "text": "It MUST NOT apply the same full-suite process to every change." + }, + { + "id": "R-5.3-3", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-4", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Trivial presentation/content change: inspect diff; run focused rendering, lint, snapshot, or component checks where useful.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-5", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Isolated component behavior: targeted unit/component tests, relevant type checks, and focused visual or interaction checks.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-6", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Business logic or algorithm: targeted tests, boundary and property tests, static checks, and independent reference or differential tests where appropriate.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-7", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Cross-module or integration change: affected-package tests, integration tests, compatibility checks, and relevant regression tests.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-8", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Schema, persistence, or migration change: migration validation, backward/forward compatibility, rollback/recovery, and data-integrity checks.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-9", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Security, authorization, concurrency, or high-impact change: threat-oriented review, adversarial cases, invariant checks, race and state-space analysis, and stronger independent verification.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-10", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "SHOULD", + "text": "Release candidate: required release gates and broader regression verification.", + "lead": "The organization SHOULD classify changes into appropriate assurance profiles, such as:" + }, + { + "id": "R-5.3-11", + "section": "5.3", + "title": "Risk-adaptive assurance", + "level": "MUST", + "text": "The agent MUST account for actual dependencies and change impact." + }, + { + "id": "R-5.4-1", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "MUST", + "text": "The organization MUST minimize the time and cost of verification while meeting the required assurance threshold." + }, + { + "id": "R-5.4-2", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "MUST", + "text": "It MUST seek the minimum sufficient verification for a given change, not the minimum possible testing and not maximum testing regardless of relevance." + }, + { + "id": "R-5.4-3", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-4", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "Which changed behavior or failure mode the check addresses.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-5", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "Which components or dependencies make it relevant.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-6", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "What evidence the check is expected to provide.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-7", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "Its estimated duration and resource cost.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-8", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "Whether an equivalent or more targeted check exists.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-9", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD", + "text": "Whether its result can be safely reused from a prior run.", + "lead": "For each expensive check, the execution planner SHOULD be able to identify:" + }, + { + "id": "R-5.4-10", + "section": "5.4", + "title": "Minimum sufficient verification", + "level": "SHOULD NOT", + "text": "A test or analysis step that has no clear connection to the change or a mandatory gate SHOULD NOT block delivery without documented justification." + }, + { + "id": "R-5.5-1", + "section": "5.5", + "title": "Test and verification infrastructure", + "level": "SHOULD", + "text": "The organization SHOULD continuously improve verification infrastructure as a high-leverage investment." + }, + { + "id": "R-5.6-1", + "section": "5.6", + "title": "Evidence and completion claims", + "level": "MUST", + "text": "The organization MUST maintain a verification record for each meaningful work unit." + }, + { + "id": "R-5.6-2", + "section": "5.6", + "title": "Evidence and completion claims", + "level": "MUST", + "text": "It MUST distinguish passed, failed, skipped, not applicable, and not run checks." + }, + { + "id": "R-5.6-3", + "section": "5.6", + "title": "Evidence and completion claims", + "level": "MUST NOT", + "text": "It MUST NOT imply that unexecuted tests passed or that a partial proof establishes a broader property than it actually does." + }, + { + "id": "R-6.1-1", + "section": "6.1", + "title": "Time is a first-class optimization dimension", + "level": "MUST", + "text": "The organization MUST aggressively minimize time from user intent to useful delivery without violating correctness, safety, or authorization constraints." + }, + { + "id": "R-6.1-2", + "section": "6.1", + "title": "Time is a first-class optimization dimension", + "level": "MUST", + "text": "It MUST measure at least:" + }, + { + "id": "R-6.1-3", + "section": "6.1", + "title": "Time is a first-class optimization dimension", + "level": "MUST", + "text": "Time to first useful result: elapsed time until the user receives a working, decision-useful, or otherwise meaningful increment.", + "lead": "It MUST measure at least:" + }, + { + "id": "R-6.1-4", + "section": "6.1", + "title": "Time is a first-class optimization dimension", + "level": "MUST", + "text": "Time to validated completion: elapsed time until the requested outcome meets its acceptance and assurance requirements.", + "lead": "It MUST measure at least:" + }, + { + "id": "R-6.1-5", + "section": "6.1", + "title": "Time is a first-class optimization dimension", + "level": "SHOULD", + "text": "The organization SHOULD also measure queue time, active execution time, time spent waiting for agents or tools, verification duration, integration time, and rework time to expose bottlenecks." + }, + { + "id": "R-6.2-1", + "section": "6.2", + "title": "Incremental delivery", + "level": "SHOULD", + "text": "The organization SHOULD deliver meaningful increments as soon as they are useful and sufficiently validated." + }, + { + "id": "R-6.2-2", + "section": "6.2", + "title": "Incremental delivery", + "level": "SHOULD", + "text": "It SHOULD avoid holding completed work hostage to unrelated investigations or checks." + }, + { + "id": "R-6.2-3", + "section": "6.2", + "title": "Incremental delivery", + "level": "MUST NOT", + "text": "Incremental delivery MUST NOT be used to disguise incomplete work, ship unsafe changes, or bypass release requirements." + }, + { + "id": "R-6.3-1", + "section": "6.3", + "title": "Flow and bottleneck management", + "level": "MUST", + "text": "The organization MUST monitor for stalled agents, long-running commands, unproductive retries, excessive context loading, redundant exploration, unnecessary approval waits, and low-value verification." + }, + { + "id": "R-6.3-2", + "section": "6.3", + "title": "Flow and bottleneck management", + "level": "SHOULD", + "text": "It SHOULD use time budgets or progress checkpoints for costly activities." + }, + { + "id": "R-6.3-3", + "section": "6.3", + "title": "Flow and bottleneck management", + "level": "MUST", + "text": "When a process is consuming disproportionate time without meaningful progress, the responsible agent MUST reassess the approach." + }, + { + "id": "R-6.3-4", + "section": "6.3", + "title": "Flow and bottleneck management", + "level": "SHOULD", + "text": "It SHOULD change strategy, narrow the problem, parallelize, use a different tool or model, or ask for an intervention when required." + }, + { + "id": "R-6.3-5", + "section": "6.3", + "title": "Flow and bottleneck management", + "level": "MUST NOT", + "text": "It MUST NOT continue indefinitely merely because work has already been invested." + }, + { + "id": "R-6.4-1", + "section": "6.4", + "title": "Test execution latency", + "level": "MUST NOT", + "text": "The organization MUST NOT default to running every test suite after every change." + }, + { + "id": "R-6.4-2", + "section": "6.4", + "title": "Test execution latency", + "level": "MUST", + "text": "It MUST use change-impact analysis and risk-adaptive assurance to identify relevant checks." + }, + { + "id": "R-6.4-3", + "section": "6.4", + "title": "Test execution latency", + "level": "SHOULD", + "text": "The organization SHOULD record the reason for expensive suites and distinguish mandatory checks from optional confidence-building checks." + }, + { + "id": "R-6.4-4", + "section": "6.4", + "title": "Test execution latency", + "level": "SHOULD", + "text": "Independent checks SHOULD run concurrently where doing so reduces wall-clock time without causing resource contention or nondeterminism that harms results." + }, + { + "id": "R-6.5-1", + "section": "6.5", + "title": "Latency budgets and service levels", + "level": "SHOULD", + "text": "The organization SHOULD establish baseline and target latency budgets by task class and complexity." + }, + { + "id": "R-6.5-2", + "section": "6.5", + "title": "Latency budgets and service levels", + "level": "SHOULD", + "text": "The system SHOULD track medians and tail latency (for example p50 and p95), because a small number of pathological tasks can dominate the user’s experience." + }, + { + "id": "R-7.1-1", + "section": "7.1", + "title": "Main-agent accountability", + "level": "MUST", + "text": "A main agent MUST own the complete outcome of each user request." + }, + { + "id": "R-7.1-2", + "section": "7.1", + "title": "Main-agent accountability", + "level": "MUST", + "text": "The main agent MUST reconcile conflicting findings, review integration quality, and ensure the final result satisfies the overall intent." + }, + { + "id": "R-7.2-1", + "section": "7.2", + "title": "Dynamic model selection", + "level": "MUST", + "text": "The organization MUST select models and agent configurations based on task requirements, capability, reliability, latency, context needs, and cost." + }, + { + "id": "R-7.2-2", + "section": "7.2", + "title": "Dynamic model selection", + "level": "SHOULD", + "text": "It SHOULD use the least expensive model that is sufficiently capable for the task, rather than defaulting every operation to the highest-end model." + }, + { + "id": "R-7.2-3", + "section": "7.2", + "title": "Dynamic model selection", + "level": "MUST", + "text": "The routing policy MUST be empirical and revisable." + }, + { + "id": "R-7.3-1", + "section": "7.3", + "title": "Model and execution cost", + "level": "SHOULD", + "text": "The organization SHOULD account for all material costs, including input tokens, output tokens, cached input, model-specific pricing, tool calls, external services, infrastructure, retries, and abandoned work." + }, + { + "id": "R-7.3-2", + "section": "7.3", + "title": "Model and execution cost", + "level": "SHOULD", + "text": "The organization SHOULD measure cost per accepted change and cost per unit of verified user value where practical." + }, + { + "id": "R-7.3-3", + "section": "7.3", + "title": "Model and execution cost", + "level": "MUST NOT", + "text": "It MUST NOT optimize raw token count at the expense of correctness, judgment, or total cost." + }, + { + "id": "R-7.4-1", + "section": "7.4", + "title": "Parallelism", + "level": "SHOULD", + "text": "The organization SHOULD parallelize independent work when doing so reduces critical-path time enough to justify coordination, context duplication, integration, review, and resource contention." + }, + { + "id": "R-7.4-2", + "section": "7.4", + "title": "Parallelism", + "level": "MUST", + "text": "It MUST distinguish independent tasks from tasks with dependencies or shared mutable state." + }, + { + "id": "R-7.4-3", + "section": "7.4", + "title": "Parallelism", + "level": "SHOULD", + "text": "It SHOULD define clear task boundaries, output contracts, ownership of files or resources, and integration points before launching concurrent implementation agents." + }, + { + "id": "R-7.4-4", + "section": "7.4", + "title": "Parallelism", + "level": "SHOULD", + "text": "The organization SHOULD measure wall-clock reduction against additional compute and coordination costs." + }, + { + "id": "R-7.5-1", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-2", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "A clear outcome and bounded scope.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-3", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Relevant context and source-of-truth references.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-4", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Constraints, interfaces, and acceptance criteria.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-5", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Expected deliverables and reporting format.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-6", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Files, resources, or modules the agent may change.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-7", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Verification expectations.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-8", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Time or cost budget where useful.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-9", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "Escalation conditions and dependencies.", + "lead": "Delegated tasks SHOULD include:" + }, + { + "id": "R-7.5-10", + "section": "7.5", + "title": "Delegation contracts", + "level": "SHOULD", + "text": "The main agent SHOULD avoid sending broad, ambiguous assignments that cause agents to duplicate discovery or make conflicting architecture decisions." + }, + { + "id": "R-7.6-1", + "section": "7.6", + "title": "Context efficiency", + "level": "SHOULD", + "text": "The organization SHOULD minimize redundant context loading, repeated repository exploration, duplicate analysis, and unnecessary agent handoffs." + }, + { + "id": "R-8.1-1", + "section": "8.1", + "title": "Long-term software value", + "level": "MUST", + "text": "The organization MUST optimize the software beyond the immediate task." + }, + { + "id": "R-8.2-1", + "section": "8.2", + "title": "Simplicity and accidental complexity", + "level": "SHOULD", + "text": "The organization SHOULD minimize accidental complexity." + }, + { + "id": "R-8.2-2", + "section": "8.2", + "title": "Simplicity and accidental complexity", + "level": "MUST NOT", + "text": "It MUST NOT equate simplicity with the fewest lines of code, fewest files, shortest implementation, or cleverest abstraction." + }, + { + "id": "R-8.3-1", + "section": "8.3", + "title": "Architecture and technical debt", + "level": "SHOULD", + "text": "The organization SHOULD preserve architectural consistency where it supports comprehension and changeability." + }, + { + "id": "R-8.3-2", + "section": "8.3", + "title": "Architecture and technical debt", + "level": "MAY", + "text": "It MAY challenge existing architecture when evidence indicates that the architecture obstructs the desired outcome or imposes disproportionate costs." + }, + { + "id": "R-8.3-3", + "section": "8.3", + "title": "Architecture and technical debt", + "level": "SHOULD", + "text": "Technical debt SHOULD be made visible and managed intentionally." + }, + { + "id": "R-8.3-4", + "section": "8.3", + "title": "Architecture and technical debt", + "level": "SHOULD", + "text": "The organization SHOULD distinguish deliberate tradeoffs from accidental deterioration and record consequential architectural decisions with their rationale and expected revisit conditions." + }, + { + "id": "R-8.4-1", + "section": "8.4", + "title": "Operational quality", + "level": "SHOULD", + "text": "Where within the user’s authorization, the organization SHOULD consider deployment safety, monitoring, alerts, incident diagnosis, rollback, data recovery, performance, and operational handoff as part of engineering delivery—not as unrelated future work." + }, + { + "id": "R-9-1", + "section": "9", + "title": "Operating model and end-to-end lifecycle", + "level": "MUST", + "text": "The organization MUST follow a coherent lifecycle." + }, + { + "id": "R-9.2-1", + "section": "9.2", + "title": "Discovery and investigation", + "level": "SHOULD", + "text": "It SHOULD use parallel research agents for independent questions." + }, + { + "id": "R-9.2-2", + "section": "9.2", + "title": "Discovery and investigation", + "level": "SHOULD", + "text": "It SHOULD prefer targeted evidence gathering over broad, expensive repository analysis." + }, + { + "id": "R-9.2-3", + "section": "9.2", + "title": "Discovery and investigation", + "level": "SHOULD", + "text": "It SHOULD identify existing functionality, constraints, technical debt, and likely failure modes before proposing unnecessary new mechanisms." + }, + { + "id": "R-9.3-1", + "section": "9.3", + "title": "Planning and decomposition", + "level": "SHOULD", + "text": "Planning SHOULD be sufficient to avoid foreseeable rework but not so elaborate that planning dominates a small task." + }, + { + "id": "R-9.4-1", + "section": "9.4", + "title": "Execution and orchestration", + "level": "SHOULD", + "text": "Agents SHOULD report discoveries that materially affect scope, risk, architecture, or estimates promptly." + }, + { + "id": "R-9.5-1", + "section": "9.5", + "title": "Integration", + "level": "MUST NOT", + "text": "Integration is an explicit responsibility and MUST NOT be assumed to happen automatically because individual agents report success." + }, + { + "id": "R-9.7-1", + "section": "9.7", + "title": "Delivery", + "level": "SHOULD", + "text": "The organization SHOULD avoid burdening the user with internal orchestration detail unless it affects the outcome or a decision is needed." + }, + { + "id": "R-9.8-1", + "section": "9.8", + "title": "Retrospective and organizational improvement", + "level": "SHOULD", + "text": "A second retrospective SHOULD occur at the end of a multi-unit user request to identify cross-unit inefficiencies and lessons that were not visible locally." + }, + { + "id": "R-10.1-1", + "section": "10.1", + "title": "Definition", + "level": "SHOULD", + "text": "The organization SHOULD avoid both extremes: overly large units that hide failures and excessively fragmented units that create coordination overhead." + }, + { + "id": "R-10.2-1", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-2", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Unique identifier and parent request or workstream.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-3", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Desired outcome and scope.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-4", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Explicit and inferred requirements relevant to the unit.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-5", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Acceptance criteria and important invariants.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-6", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Risk and assurance profile.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-7", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Plan, dependencies, and assigned agents or tools.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-8", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Model selections and material resource budgets.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-9", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Start/end times and execution telemetry.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-10", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Changed artifacts and implementation summary.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-11", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Verification actions and results.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-12", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Deferred checks, known limitations, and unresolved risks.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-13", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Delivery status.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-14", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Performance scorecard.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.2-15", + "section": "10.2", + "title": "Required work-unit record", + "level": "MUST", + "text": "Improvement findings and resulting learning records.", + "lead": "Every meaningful work unit MUST have a durable record containing, at minimum:" + }, + { + "id": "R-10.3-1", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "A work unit is complete only when:" + }, + { + "id": "R-10.3-2", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Its intended outcome has been implemented or explicitly resolved.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-3", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Acceptance criteria are met or deviations are explicitly accepted by an authorized party.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-4", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Required verification has passed.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-5", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Material failures and limitations are disclosed.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-6", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Its execution evidence is recorded.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-7", + "section": "10.3", + "title": "Completion criteria", + "level": "DEFINITION", + "text": "Its mandatory improvement analysis has been performed.", + "lead": "A work unit is complete only when:" + }, + { + "id": "R-10.3-8", + "section": "10.3", + "title": "Completion criteria", + "level": "MAY", + "text": "A work unit MAY be stopped or cancelled when its premise is disproven, its expected value falls below cost, or a safer/better approach supersedes it." + }, + { + "id": "R-11.1-1", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-2", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Measure performance against the objective and available evidence.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-3", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Identify underperformance, wasted effort, errors, surprises, and missed opportunities.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-4", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Produce specific recommendations describing how the outcome or process could have been better.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-5", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Identify root causes rather than merely restating symptoms.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-6", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Determine which recommendations generalize beyond the immediate task.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-7", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Convert actionable lessons into persistent, appropriately scoped mechanisms.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-8", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Validate the changes and make approved improvements available to future sessions.", + "lead": "After every meaningful work unit, the organization MUST:" + }, + { + "id": "R-11.1-9", + "section": "11.1", + "title": "Core requirement", + "level": "MUST NOT", + "text": "The organization MUST NOT satisfy this requirement with generic statements such as “be more careful,” “write better tests,” or “use cheaper models.”" + }, + { + "id": "R-11.1-10", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Every meaningful work unit MUST produce an explicit list of concrete ways the organization could have scored better, even when the work unit was successful and all acceptance criteria were met." + }, + { + "id": "R-11.1-11", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Each opportunity MUST include a proposed action or mechanism, an expected effect, and a validation approach." + }, + { + "id": "R-11.1-12", + "section": "11.1", + "title": "Core requirement", + "level": "SHOULD", + "text": "Opportunities SHOULD be prioritized by expected value, confidence, implementation cost, and risk." + }, + { + "id": "R-11.1-13", + "section": "11.1", + "title": "Core requirement", + "level": "MUST NOT", + "text": "The organization MUST NOT invent low-value changes merely to populate the list; it must record why an apparent opportunity is not worth promoting." + }, + { + "id": "R-11.1-14", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "Each work unit MUST persist a learning-review artifact." + }, + { + "id": "R-11.1-15", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "At least one relevant learning MUST be made available to subsequent work at the correct scope: organization-wide, user-specific, project-specific, workstream-specific, or task-specific." + }, + { + "id": "R-11.1-16", + "section": "11.1", + "title": "Core requirement", + "level": "MUST", + "text": "When no reusable mechanism should be promoted, the review MUST still persist the concrete finding and its applicability limits." + }, + { + "id": "R-11.2-1", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-2", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Did the result solve the user’s actual problem?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-3", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Which explicit, implied, contextual, or anticipated requirements were missed or discovered late?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-4", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "What assumptions were wrong, and which were useful?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-5", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "What decisions were unnecessarily expensive or slow?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-6", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Where was wall-clock time spent, including queueing, waiting, execution, tests, integration, and rework?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-7", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Were models and agents appropriately selected for their tasks?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-8", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Did parallelism reduce the critical path, or did coordination erase the benefit?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-9", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Was context loaded, repeated, or delegated inefficiently?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-10", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Was verification too weak, too broad, too slow, or redundant?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-11", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "What defects, regressions, or uncertainties escaped earlier detection?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-12", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "Did the implementation increase or reduce future change cost?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-13", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "What could have been anticipated or automated?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.2-14", + "section": "11.2", + "title": "Required retrospective questions", + "level": "MUST", + "text": "What exact mechanism should change so that future work performs better?", + "lead": "The retrospective MUST consider:" + }, + { + "id": "R-11.3-1", + "section": "11.3", + "title": "Mechanism-based learning", + "level": "SHOULD", + "text": "The organization SHOULD choose the mechanism that addresses the root cause." + }, + { + "id": "R-11.3-2", + "section": "11.3", + "title": "Mechanism-based learning", + "level": "MUST", + "text": "A promoted mechanism MUST be automatically available to future sessions at its intended scope; relying on an agent to remember to consult an unconnected learning store is not sufficient." + }, + { + "id": "R-11.4-1", + "section": "11.4", + "title": "Learning record schema", + "level": "SHOULD", + "text": "Each learning SHOULD be represented as a structured, versioned artifact with fields equivalent to:" + }, + { + "id": "R-11.4-2", + "section": "11.4", + "title": "Learning record schema", + "level": "MAY", + "text": "The implementation MAY use a database, files, event store, or another durable representation." + }, + { + "id": "R-11.5-1", + "section": "11.5", + "title": "Promotion process", + "level": "SHOULD", + "text": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-2", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Observed: a signal or opportunity has been identified.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-3", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Analyzed: root cause, scope, and expected benefit are understood.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-4", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Proposed: a specific mechanism change is defined.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-5", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Implemented: the change exists in a testable form.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-6", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Validated: the change has been evaluated against the original scenario and relevant regression cases.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-7", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Promoted: the change is available at the appropriate scope for future sessions.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-8", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Monitored: its effects are observed in subsequent work.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-9", + "section": "11.5", + "title": "Promotion process", + "level": "DEFINITION", + "text": "Revised or reverted: the change is adjusted or removed if it underperforms or creates adverse effects.", + "lead": "Learning changes SHOULD move through explicit states:" + }, + { + "id": "R-11.5-10", + "section": "11.5", + "title": "Promotion process", + "level": "SHOULD", + "text": "Low-risk, reversible improvements SHOULD be eligible for autonomous promotion." + }, + { + "id": "R-11.5-11", + "section": "11.5", + "title": "Promotion process", + "level": "MUST", + "text": "Changes to security boundaries, authorization, objective constraints, destructive behavior, or high-impact global policies MUST follow stronger approval and validation requirements." + }, + { + "id": "R-11.6-1", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "MUST NOT", + "text": "The organization MUST NOT convert every isolated incident into a universal rule." + }, + { + "id": "R-11.6-2", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "MUST", + "text": "It MUST determine whether a lesson is global, user-specific, project-specific, or task-specific." + }, + { + "id": "R-11.6-3", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "SHOULD", + "text": "It SHOULD validate improvements against the originating task, similar historical tasks, held-out tasks, and counterexamples where practical." + }, + { + "id": "R-11.6-4", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "SHOULD", + "text": "It SHOULD use shadow evaluation, canary rollout, or versioned policy comparison for consequential changes." + }, + { + "id": "R-11.6-5", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "MUST", + "text": "The system MUST preserve provenance and be able to identify which policies and mechanisms were active for a given work unit." + }, + { + "id": "R-11.6-6", + "section": "11.6", + "title": "Avoiding overfitting and harmful learning", + "level": "MUST", + "text": "It MUST support rollback of harmful improvements." + }, + { + "id": "R-11.7-1", + "section": "11.7", + "title": "Improving the improvement system", + "level": "SHOULD", + "text": "The organization SHOULD learn how to score more reliably, identify stronger root causes, discover reusable patterns, validate changes more cheaply, and avoid self-evaluation bias." + }, + { + "id": "R-11.7-2", + "section": "11.7", + "title": "Improving the improvement system", + "level": "MUST NOT", + "text": "The agent MUST NOT unilaterally redefine the enduring objective or weaken non-negotiable constraints as a way of improving its score." + }, + { + "id": "R-11.7-3", + "section": "11.7", + "title": "Improving the improvement system", + "level": "MAY", + "text": "It MAY recommend changes to the objective or evaluation model, but such changes require explicit owner review and separate versioning." + }, + { + "id": "R-12-1", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "MUST", + "text": "The organization MUST persist useful context so future sessions do not repeatedly rediscover information already learned." + }, + { + "id": "R-12-2", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "MUST", + "text": "Persistence MUST be scoped to prevent accidental generalization or leakage." + }, + { + "id": "R-12-3", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Recommended logical layers are:" + }, + { + "id": "R-12-4", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Organization-wide knowledge: operating policies, model routing, reusable skills, tools, verification standards, validated lessons, and shared benchmarks.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-5", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "User-specific preferences: interaction preferences, autonomy expectations, communication style, and stable engineering preferences relevant to the work.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-6", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Project-specific knowledge: architecture, code conventions, domain model, dependencies, invariants, decisions, constraints, and test strategy.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-7", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Workstream knowledge: current initiative, plans, interfaces, unresolved decisions, and dependencies across work units.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-8", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Work-unit working state: task-local assumptions, discoveries, intermediate outputs, and execution state.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-9", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "DEFINITION", + "text": "Executable capabilities: scripts, tools, workflows, agent skills, policies, evaluators, and infrastructure that operationalize knowledge.", + "lead": "Recommended logical layers are:" + }, + { + "id": "R-12-10", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "SHOULD", + "text": "Each knowledge item SHOULD include provenance, timestamp or version, scope, confidence, validity conditions, and supersession information." + }, + { + "id": "R-12-11", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "SHOULD", + "text": "The system SHOULD detect contradictions and stale knowledge rather than silently combining it." + }, + { + "id": "R-12-12", + "section": "12", + "title": "Knowledge, memory, and persistence architecture", + "level": "SHOULD", + "text": "Knowledge retrieval SHOULD be relevance-driven." + }, + { + "id": "R-13.1-1", + "section": "13.1", + "title": "Multidimensional scorecard", + "level": "MUST", + "text": "The organization MUST produce a scorecard for each meaningful work unit and aggregate trends by project, task class, model, agent, and policy version where data supports it." + }, + { + "id": "R-13.2-1", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-2", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Requirement surprise rate: frequency and impact of material requirements discovered after implementation or delivery that should reasonably have been inferred earlier.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-3", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Rework rate: proportion of work repeated or corrected due to misunderstanding, poor implementation, insufficient verification, or avoidable process failures.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-4", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Cost per accepted change: total attributable cost divided by changes accepted by the user or project acceptance process.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-5", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Verification efficiency: useful risk reduction or defect detection relative to elapsed time and resource cost.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-6", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Delegation benefit: reduction in critical-path time compared with expected serial execution, offset by added compute, coordination, and integration effort.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-7", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Improvement realization rate: proportion of promoted changes that produce their expected effect without unacceptable regressions.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-8", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "Failure recurrence rate: frequency with which a previously identified and supposedly mitigated failure pattern appears again.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-9", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "First-pass acceptance: proportion of work units accepted without material user correction or avoidable rework.", + "lead": "The organization SHOULD track at least the following derived measures where practical:" + }, + { + "id": "R-13.2-10", + "section": "13.2", + "title": "Important derived metrics", + "level": "SHOULD", + "text": "These metrics SHOULD be segmented by task category and complexity." + }, + { + "id": "R-13.2-11", + "section": "13.2", + "title": "Important derived metrics", + "level": "MUST NOT", + "text": "Aggregates MUST NOT conceal the fact that one category is improving while another is deteriorating." + }, + { + "id": "R-13.3-1", + "section": "13.3", + "title": "Evidence sources", + "level": "SHOULD", + "text": "Scoring SHOULD combine:" + }, + { + "id": "R-13.3-2", + "section": "13.3", + "title": "Evidence sources", + "level": "SHOULD", + "text": "Execution telemetry: timestamps, commands, tool calls, model identity, token counts, costs, retries, test duration, and agent activity.", + "lead": "Scoring SHOULD combine:" + }, + { + "id": "R-13.3-3", + "section": "13.3", + "title": "Evidence sources", + "level": "SHOULD", + "text": "Artifact evidence: diffs, build outputs, test reports, static analysis, proof artifacts, benchmark results, and deployment records.", + "lead": "Scoring SHOULD combine:" + }, + { + "id": "R-13.3-4", + "section": "13.3", + "title": "Evidence sources", + "level": "SHOULD", + "text": "Independent evaluation: reviewers or evaluators that assess requirements, code quality, correctness, and evidence independently of the primary implementer where practical.", + "lead": "Scoring SHOULD combine:" + }, + { + "id": "R-13.3-5", + "section": "13.3", + "title": "Evidence sources", + "level": "SHOULD", + "text": "Outcome evidence: user acceptance, corrections, incidents, subsequent changes, production behavior, and real-world product outcomes.", + "lead": "Scoring SHOULD combine:" + }, + { + "id": "R-13.3-6", + "section": "13.3", + "title": "Evidence sources", + "level": "MUST NOT", + "text": "The main agent MAY perform self-assessment, but MUST NOT be the sole source of truth for objective measurements or consequential correctness claims." + }, + { + "id": "R-13.4-1", + "section": "13.4", + "title": "Scoring confidence and missing data", + "level": "SHOULD", + "text": "Every score SHOULD indicate whether it is measured, inferred, estimated, or unavailable." + }, + { + "id": "R-13.4-2", + "section": "13.4", + "title": "Scoring confidence and missing data", + "level": "MUST NOT", + "text": "The organization MUST NOT fabricate precision or treat missing telemetry as evidence of good performance." + }, + { + "id": "R-13.4-3", + "section": "13.4", + "title": "Scoring confidence and missing data", + "level": "SHOULD", + "text": "It SHOULD improve observability when missing data prevents meaningful evaluation." + }, + { + "id": "R-13.5-1", + "section": "13.5", + "title": "No single-score optimization", + "level": "MUST", + "text": "An aggregate index MAY be maintained for trend visualization, but decisions MUST also inspect the underlying scorecard, hard-gate outcomes, confidence, and relevant counter-metrics." + }, + { + "id": "R-14.1-1", + "section": "14.1", + "title": "Autonomous-by-default within authorization", + "level": "SHOULD", + "text": "The organization SHOULD independently perform investigation, planning, implementation, routine testing, reversible internal changes, and low-risk improvements within the permissions granted by the user and environment." + }, + { + "id": "R-14.1-2", + "section": "14.1", + "title": "Autonomous-by-default within authorization", + "level": "MUST NOT", + "text": "It MUST respect explicit approval boundaries and MUST NOT infer authorization for consequential external actions simply from a request to build software." + }, + { + "id": "R-14.2-1", + "section": "14.2", + "title": "Escalation and approval", + "level": "MUST", + "text": "The organization MUST pause for authorization when a contemplated action is destructive, irreversible, externally visible, financially consequential, security-sensitive, privacy-sensitive, or outside granted permissions." + }, + { + "id": "R-14.2-2", + "section": "14.2", + "title": "Escalation and approval", + "level": "SHOULD", + "text": "It SHOULD seek clarification when ambiguity materially affects the result or risk." + }, + { + "id": "R-14.3-1", + "section": "14.3", + "title": "Objective and constraint governance", + "level": "MUST", + "text": "The core objective, non-negotiable constraints, and authority model MUST be versioned and protected from unilateral weakening by the agent." + }, + { + "id": "R-14.3-2", + "section": "14.3", + "title": "Objective and constraint governance", + "level": "MAY", + "text": "The organization MAY propose refinements, but the owner controls approval of changes that alter what counts as success or what actions are permitted." + }, + { + "id": "R-14.4-1", + "section": "14.4", + "title": "Policy change governance", + "level": "SHOULD", + "text": "Policy changes SHOULD be classified by impact and reversibility." + }, + { + "id": "R-15-1", + "section": "15", + "title": "Failure handling and recovery", + "level": "MUST", + "text": "The organization MUST treat failure as information, not as a reason to continue blindly." + }, + { + "id": "R-15-2", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-3", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Stalled execution: no meaningful progress within the expected interval; reassess approach or reassign.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-4", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Repeated failure: retries are not producing new information; stop, diagnose, and change strategy.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-5", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Infrastructure failure: distinguish environment/tool outage from product defect; avoid wasting compute on unchanged retries.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-6", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Flaky verification: isolate instability, preserve transparency, and do not silently remove meaningful gates.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-7", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Conflicting agent outputs: resolve using evidence, source-of-truth hierarchy, and independent verification.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-8", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Scope or specification error: revisit intent and acceptance criteria rather than patching downstream symptoms.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-9", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Integration failure: establish explicit ownership and test the combined system.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-10", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Regression: assess blast radius, revert or repair, preserve evidence, and create an improvement record.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-11", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "Unsafe or unauthorized action: stop, contain, notify as appropriate, and preserve auditability.", + "lead": "It SHOULD recognize and respond to:" + }, + { + "id": "R-15-12", + "section": "15", + "title": "Failure handling and recovery", + "level": "SHOULD", + "text": "The organization SHOULD maintain checkpoints and recovery mechanisms for consequential operations." + }, + { + "id": "R-15-13", + "section": "15", + "title": "Failure handling and recovery", + "level": "MUST", + "text": "It MUST make failure states and incomplete work visible." + }, + { + "id": "R-16-1", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "The organization MUST treat security, privacy, and data integrity as foundational constraints across agent reasoning, tools, delegation, memory, execution, and self-modification." + }, + { + "id": "R-16-2", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "It MUST:" + }, + { + "id": "R-16-3", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Enforce least-privilege access for agents and tools.", + "lead": "It MUST:" + }, + { + "id": "R-16-4", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Keep secrets out of prompts, logs, source control, and learning artifacts unless an authorized secure mechanism requires them.", + "lead": "It MUST:" + }, + { + "id": "R-16-5", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Respect project, user, and organization data boundaries.", + "lead": "It MUST:" + }, + { + "id": "R-16-6", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Treat retrieved files, code, web pages, issue text, and tool outputs as data rather than trusted instructions.", + "lead": "It MUST:" + }, + { + "id": "R-16-7", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Validate external inputs and tool results before using them for consequential actions.", + "lead": "It MUST:" + }, + { + "id": "R-16-8", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Record consequential operations and policy changes with appropriate audit trails.", + "lead": "It MUST:" + }, + { + "id": "R-16-9", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Preserve data integrity and provide recovery or rollback for risky changes where possible.", + "lead": "It MUST:" + }, + { + "id": "R-16-10", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Ensure that subagents receive only the context and permissions they need.", + "lead": "It MUST:" + }, + { + "id": "R-16-11", + "section": "16", + "title": "Security, privacy, and data integrity", + "level": "MUST", + "text": "Prevent the Evolution Engine from silently widening permissions or weakening controls.", + "lead": "It MUST:" + }, + { + "id": "R-17-1", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "The organization SHOULD:" + }, + { + "id": "R-17-2", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Communicate progress when useful, especially when work is long-running or blocked.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-3", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Avoid noisy narration of routine internal activity.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-4", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Ask concise, consequential questions rather than broad questionnaires.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-5", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Explain material assumptions and deviations.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-6", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Deliver useful intermediate results where appropriate.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-7", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Provide a concise completion summary, relevant artifacts, verification evidence, and material limitations.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-8", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "Avoid requiring the user to understand the internal agent topology or manually coordinate subagents.", + "lead": "The organization SHOULD:" + }, + { + "id": "R-17-9", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "A typical completion report should include:" + }, + { + "id": "R-17-10", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "What outcome was delivered.", + "lead": "A typical completion report should include:" + }, + { + "id": "R-17-11", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "Important behavior or design decisions.", + "lead": "A typical completion report should include:" + }, + { + "id": "R-17-12", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "What verification was performed and the result.", + "lead": "A typical completion report should include:" + }, + { + "id": "R-17-13", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "What was not verified or remains uncertain.", + "lead": "A typical completion report should include:" + }, + { + "id": "R-17-14", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "DEFINITION", + "text": "Any material risks, follow-up work, or operational actions.", + "lead": "A typical completion report should include:" + }, + { + "id": "R-17-15", + "section": "17", + "title": "User-facing behavior and delivery contract", + "level": "SHOULD", + "text": "The report SHOULD be proportional to the change." + }, + { + "id": "R-18-1", + "section": "18", + "title": "Anti-patterns and prohibited optimization shortcuts", + "level": "SHOULD", + "text": "The organization SHOULD actively detect and avoid the following:" + }, + { + "id": "R-19-1", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-2", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Inventory the current system. Identify agents, prompts, tools, workflows, memory stores, evaluators, test infrastructure, policies, metrics, and permission boundaries.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-3", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Map to this specification. For each existing component, identify which requirement it serves, whether it is effective, and what evidence supports that judgment.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-4", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Classify gaps and liabilities. Distinguish missing capabilities, ineffective mechanisms, duplicated responsibilities, conflicting policies, excessive complexity, and useful foundations.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-5", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Establish a baseline. Measure current task performance across representative work: intent fulfillment, correctness evidence, time, cost, human intervention, and rework.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-6", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Preserve useful assets. Retain components that demonstrably contribute to the objective. Replace or retire mechanisms that create cost without corresponding value.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-7", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Stabilize the objective and constraints. Make the north-star objective, optimization hierarchy, authority model, and core definitions explicit and versioned.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-8", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Implement the work-unit lifecycle. Introduce outcome definition, execution evidence, verification records, and post-unit improvement analysis.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-9", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Create the learning mechanism. Add structured learning records, mechanism types, scope, validation, promotion, versioning, and rollback.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-10", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Build the evaluation harness. Capture representative tasks and measure policy changes against baseline and regression cases.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-11", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "Evolve incrementally. Improve one high-leverage bottleneck at a time, verify the effect, and avoid a wholesale rewrite unless evidence establishes that it is necessary.", + "lead": "The project SHOULD be reconciled in stages:" + }, + { + "id": "R-19-12", + "section": "19", + "title": "Requirements for reconciling an existing project", + "level": "SHOULD", + "text": "The first implementation milestone SHOULD be observability and control, not sophistication: the organization must be able to explain what it did, what it cost, what evidence it produced, and what it learned before attempting aggressive self-optimization." + }, + { + "id": "R-20-1", + "section": "20", + "title": "Conformance and maturity criteria", + "level": "DEFINITION", + "text": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-1", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Has an explicit, versioned objective and non-negotiable constraints.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-2", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Treats user intent and outcome ownership as primary responsibilities.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-3", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Has a main agent accountable for end-to-end delivery.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-4", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Uses bounded work units with acceptance criteria.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-5", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Records execution and verification evidence.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-6", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Performs mandatory post-work-unit performance analysis.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.1-7", + "section": "20.1", + "title": "Foundational conformance", + "level": "DEFINITION", + "text": "Creates persistent, scoped learning records.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-1", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Dynamically routes tasks to appropriate models and agents.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-2", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Uses useful parallelism and tracks coordination costs.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-3", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Performs change-impact analysis and risk-adaptive verification.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-4", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Measures time, cost, human effort, rework, and outcome quality.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-5", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Detects stalled work and changes strategy.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-6", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Makes learnings available to future sessions.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.2-7", + "section": "20.2", + "title": "Operational conformance", + "level": "DEFINITION", + "text": "Versions consequential policies and supports rollback.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-1", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Maintains a growing benchmark suite from real engineering work and discovered failure modes.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-2", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Tests organizational policy changes against historical, held-out, and counterexample tasks.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-3", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Uses independent evaluation to reduce self-scoring bias.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-4", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Improves verification infrastructure and correctness assurance techniques over time.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-5", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Demonstrates measured reduction in delivery latency and cost without degrading correctness or user acceptance.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-6", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Demonstrates improving requirement inference and lower requirement surprise/rework.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-7", + "section": "20.3", + "title": "Advanced conformance", + "level": "DEFINITION", + "text": "Demonstrates that promoted organizational improvements have measurable, sustained effects.", + "lead": "A system conforms to this specification when it demonstrates the following capabilities:" + }, + { + "id": "R-20.3-8", + "section": "20.3", + "title": "Advanced conformance", + "level": "MUST NOT", + "text": "A system MUST NOT claim to be improving solely because it has accumulated more prompts, skills, agents, tools, or learning records." + }, + { + "id": "R-21-1", + "section": "21", + "title": "Open implementation decisions", + "level": "SHOULD", + "text": "These decisions SHOULD be documented as implementation decisions linked to the requirement(s) they satisfy." + }, + { + "id": "R-21-2", + "section": "21", + "title": "Open implementation decisions", + "level": "MUST NOT", + "text": "They MUST NOT silently redefine the north-star objective." + }, + { + "id": "R-D-1", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-2", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Delivers outcomes that more accurately match the user’s actual intent.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-3", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Anticipates important implied needs with less user prompting and less scope waste.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-4", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Produces software with strong, honest, risk-appropriate correctness evidence.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-5", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Delivers useful, validated results in progressively less elapsed time.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-6", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Reduces cost per accepted and verified change through intelligent model, agent, and tool allocation.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-7", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Reduces human supervision and correction burden without exceeding authorization.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-8", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Improves the long-term quality and evolvability of the software.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-9", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Converts every meaningful engagement into validated improvements to its own operating capability.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + }, + { + "id": "R-D-10", + "section": "D", + "title": "Definition of organizational success", + "level": "DEFINITION", + "text": "Avoids repeating known failures and demonstrates that its learning mechanisms produce sustained benefit.", + "lead": "The organization is succeeding when, over comparable and increasingly challenging engineering work, it demonstrates that it:" + } +] diff --git a/tests/test_spec.py b/tests/test_spec.py new file mode 100644 index 0000000..2159229 --- /dev/null +++ b/tests/test_spec.py @@ -0,0 +1,135 @@ +"""SPEC.md is pinned by hash, and every normative statement in it is extracted verbatim into +docs/spec/requirements.json: the extraction is checked for well-formedness, for verbatim +occurrence in the specification, and for completeness against every keyword sentence.""" +import hashlib, json, os, re, unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +SPEC = os.path.join(ROOT, "SPEC.md") +SUMS = os.path.join(ROOT, "docs", "spec", "SHA256SUMS") +REQUIREMENTS = os.path.join(ROOT, "docs", "spec", "requirements.json") + +LEVELS = {"MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY", "DEFINITION"} +ID_RE = re.compile(r"^R-(0|[0-9]+(\.[0-9]+)?|[A-D])-[0-9]+$") +KEYWORD_RE = re.compile(r"\b(MUST NOT|MUST|SHOULD NOT|SHOULD|MAY)\b") +LIST_MARKER_RE = re.compile(r"^\s*(?:-\s+|\d+\.\s+)") + + +def strip_markdown(line): + line = LIST_MARKER_RE.sub("", line) + line = line.replace("**", "").replace("*", "") + line = re.sub(r"\\(.)", r"\1", line) + return re.sub(r"\s+", " ", line).strip() + + +def normalised_spec(): + with open(SPEC, encoding="utf-8") as fh: + lines = [strip_markdown(line) for line in fh] + return re.sub(r"\s+", " ", " ".join(lines)).strip() + + +def split_sentences(text): + """Split on sentence-final punctuation; a '.' between digits (decimals, section + numbers, p50/p95-style tokens have none) is not a boundary, and a closing quote + after the punctuation stays with its sentence.""" + protected = re.sub(r"(\d)\.(\d)", lambda m: m.group(1) + "\x01" + m.group(2), text) + parts, start, i = [], 0, 0 + while i < len(protected): + if protected[i] in ".!?": + j = i + 1 + while j < len(protected) and protected[j] in "”\"’')": + j += 1 + if j < len(protected) and protected[j] == " ": + k = j + while k < len(protected) and protected[k] == " ": + k += 1 + if k < len(protected) and (protected[k].isupper() or protected[k].isdigit() + or protected[k] in "“\"("): + parts.append(protected[start:j]) + start, i = k, k + continue + i += 1 + parts.append(protected[start:]) + return [p.replace("\x01", ".").strip() for p in parts if p.strip()] + + +def load_requirements(): + with open(REQUIREMENTS, encoding="utf-8") as fh: + return json.load(fh) + + +class PinnedSourceTests(unittest.TestCase): + def test_spec_files_match_sha256sums(self): + expected = {} + with open(SUMS, encoding="utf-8") as fh: + for line in fh: + line = line.strip() + if line: + digest, name = line.split(None, 1) + expected[name.strip()] = digest + for name in ("SPEC.md", "docs/spec/engineering_organization_spec.docx"): + self.assertIn(name, expected) + with open(os.path.join(ROOT, name), "rb") as fh: + actual = hashlib.sha256(fh.read()).hexdigest() + self.assertEqual(actual, expected[name], name) + + +class RequirementsFormTests(unittest.TestCase): + def test_requirements_are_well_formed(self): + reqs = load_requirements() + self.assertIsInstance(reqs, list) + ids = [r["id"] for r in reqs] + self.assertEqual(len(ids), len(set(ids)), "duplicate requirement ids") + counters = {} + for r in reqs: + self.assertRegex(r["id"], ID_RE, r["id"]) + self.assertIn(r["level"], LEVELS, r["id"]) + self.assertTrue(r["section"], r["id"]) + self.assertTrue(r["title"], r["id"]) + self.assertTrue(r["text"], r["id"]) + counters[r["section"]] = counters.get(r["section"], 0) + 1 + self.assertEqual(r["id"], "R-%s-%d" % (r["section"], counters[r["section"]]), + "ids must be numbered consecutively from 1 within each section") + + def test_requirements_meet_sanity_floor(self): + reqs = load_requirements() + self.assertGreaterEqual(len(reqs), 150) + top = {r["section"].split(".")[0] for r in reqs} + for n in range(1, 21): + self.assertIn(str(n), top, "no requirement in section %d" % n) + self.assertIn("D", top, "no requirement in appendix D") + + +class VerbatimTests(unittest.TestCase): + def test_every_text_and_lead_occurs_verbatim_in_spec(self): + spec = normalised_spec() + for r in load_requirements(): + self.assertIn(r["text"], spec, r["id"]) + if "lead" in r: + self.assertIn(r["lead"], spec, r["id"]) + + +class CompletenessTests(unittest.TestCase): + def test_every_keyword_sentence_is_covered(self): + reqs = load_requirements() + covered = set() + for r in reqs: + covered.add(r["text"]) + if "lead" in r: + covered.add(r["lead"]) + missing = [] + with open(SPEC, encoding="utf-8") as fh: + for lineno, raw in enumerate(fh, 1): + line = strip_markdown(raw) + if line.startswith("The words MUST, MUST NOT"): + continue # the definitions paragraph, not a requirement + if not KEYWORD_RE.search(line): + continue + for sentence in split_sentences(line): + if KEYWORD_RE.search(sentence) and sentence not in covered: + missing.append("%d: %s" % (lineno, sentence)) + self.assertEqual(missing, [], "keyword sentences not in requirements.json:\n" + + "\n".join(missing)) + + +if __name__ == "__main__": + unittest.main()