Skip to content

Latest commit

 

History

History
94 lines (78 loc) · 7.89 KB

File metadata and controls

94 lines (78 loc) · 7.89 KB

ControlFlow Agent System — Shared Policies

Continuity

Use plans/project-context.md as the stable reference for agent roster, complexity tiers, semantic risk taxonomy, and shared conventions.

Build and Test

cd evals && npm test              # full offline suite: schema + behavior + orchestration + drift
npm run test:structural           # schema/P.A.R.T structure only (faster)
npm run test:behavior             # prompt-behavior + orchestration-handoff regressions only

Scenarios are in evals/scenarios/. Validate against matching schemas in schemas/.

Path Resolution

Agent resource paths are workspace-relative by default. When a file listed in any agent's ## Resources section is not found in the active workspace root:

  1. Retry the read using the absolute prefix {{VSCODE_USER_PROMPTS_FOLDER}}/ (for example, {{VSCODE_USER_PROMPTS_FOLDER}}/governance/model-routing.json).
  2. If still not found, log the missing path in the gate event and continue with confidence reduced by 0.1 per missing critical file.
  3. Never fabricate file contents. Never silently proceed as if a missing governance file contained default values.
  4. Applies to governance/, schemas/, plans/project-context.md, docs/agent-engineering/, and skills/ paths referenced in agent ## Resources sections.

This boot-time rule intentionally duplicates docs/agent-engineering/TOOL-ROUTING.md Rule 8 so global user-level agents can recover before TOOL-ROUTING.md itself is loaded.

Failure Classification

When status is FAILED, NEEDS_INPUT, NEEDS_REVISION, or REJECTED, include failure_classification:

  • transient — Flaky test, network timeout, or temporary tool unavailability; retry with identical scope.
  • fixable — Small correctable issue (typo, missing import, config value); retry with fix hint.
  • needs_replan — Architecture mismatch or missing dependency; delegate to Planner for targeted replan.
  • escalate — Security vulnerability, data integrity risk, or unresolvable blocker; stop and await human approval.
  • model_unavailable — the routed/primary model is unavailable or unreachable; substitute per model-routing fallback and retry up to model_unavailable_max (see runtime-policy.json), then escalate. Distinct from transient; the PlanAuditor/AssumptionVerifier transient-exclusion does NOT exclude model_unavailable.

NOTES.md

Maintain/update NOTES.md for persistent state across context resets:

  • Active objective and current phase.
  • Blockers and unresolved risks.
  • Remove stale entries when superseded.
  • Keep within the 20-line budget (enforced by evals/validate.mjs Pass 7, style drift checked via validateNotesMdStyle in evals/drift-checks.mjs).

See docs/agent-engineering/MEMORY-ARCHITECTURE.md for the canonical three-layer memory model (session / task-episodic / repo-persistent). NOTES.md holds repo-persistent active-objective state only; task-specific history lives in plans/artifacts/<task-slug>/.

Before writing to /memories/repo/ or updating NOTES.md at a phase boundary, load and follow skills/patterns/repo-memory-hygiene.md (dedup checklist + prune routine).

To identify plans ready for archival: cd evals && npm run archive:dry. To execute: npm run archive:apply.

Governance Docs

Agent engineering policies are in docs/agent-engineering/:

  • PART-SPEC.md — P.A.R.T. specification (mandatory section order: Prompt → Archive → Resources → Tools).
  • RELIABILITY-GATES.md — Verification gate requirements (build/tests/lint).
  • CLARIFICATION-POLICY.md — When to invoke vscode/askQuestions vs. return NEEDS_INPUT.
  • TOOL-ROUTING.md — Routing rules for external tools (fetch, githubRepo, MCP).
  • SCORING-SPEC.md — Quantitative scoring reference.
  • MIGRATION-CORE-FIRST.md — Shared implementation backbone pattern and consolidation exit criteria.
  • PROMPT-BEHAVIOR-CONTRACT.md — Behavioral invariants complementing P.A.R.T structural rules.

Conventions

  • Agent files live at repo root: <Name>.agent.md or <Name>-subagent.agent.md.
  • Artifacts: plans → plans/, schemas → schemas/, skill patterns → skills/patterns/.
  • All agent outputs use structured text. Do NOT output raw JSON to chat — it wastes context tokens.
  • Skill library is at skills/index.md. Planner selects ≤3 skills per plan phase.
  • skills/patterns/llm-behavior-guidelines.md is a meta-skill for preventing systematic agent anti-patterns (scope drift, over-abstraction, silent assumptions, weak success criteria). CoreImplementer, UIImplementer, CodeReviewer, and Planner load it on non-trivial tasks.
  • Failure taxonomy applies to all agents; PlanAuditor and AssumptionVerifier exclude transient.
  • P.A.R.T. section order in every agent file: Prompt → Archive → Resources → Tools (see PART-SPEC.md).
  • Orchestrator and Planner must delegate only to project-internal agents documented in plans/project-context.md; external/third-party agents are strictly prohibited.
  • Adding/editing agents or skills: follow the agent-contribution process in CONTRIBUTING.md (create agent file, schema, eval scenarios, register in plans/project-context.md).
  • Tool and agent permission grants are in governance/ (agent-grants.json, tool-grants.json, runtime-policy.json, rename-allowlist.json). Update these when changing an agent's tool profile.

Code Documentation and Language

  • Before completing an implementation phase, review the changed code for documentation that preserves non-obvious business rules, invariants, exceptions, constraints, and decision rationale. Comments should explain why the behavior exists or what business condition it protects, not narrate syntax or restate the code.
  • For new or materially changed public or extensible symbols that need API documentation, use the language/ecosystem-native format and the project's existing level of detail (for example, XML documentation comments in C#, docstrings in Python, or JSDoc/TSDoc in JavaScript/TypeScript). Document contract details such as parameters, return values, side effects, and expected exceptions only where they are meaningful and consistent with nearby code.
  • Match the natural language of the nearest existing code documentation. Use this precedence: the same symbol or type, then the current file/module, then the project's primary documentation language. If no reliable convention exists, use concise English. Do not mix languages within a local documentation block or translate unrelated existing comments unless the task explicitly requires it.
  • Do not add comments by quota, boilerplate documentation for self-explanatory code, or documentation churn in untouched areas. Update stale nearby documentation only when the code change makes it inaccurate.

Agent System

13 agents in the ControlFlow system:

  • Orchestration: Orchestrator
  • Planning: Planner
  • Adversarial Review: PlanAuditor-subagent, AssumptionVerifier-subagent
  • Executability Verification: ExecutabilityVerifier-subagent
  • Implementation: CoreImplementer-subagent, UIImplementer-subagent, PlatformEngineer-subagent
  • Review: CodeReviewer-subagent
  • Research: Researcher-subagent, CodeMapper-subagent
  • Documentation: TechnicalWriter-subagent
  • Testing: BrowserTester-subagent

Complexity tiers: TRIVIAL / SMALL / MEDIUM / LARGE — see plans/project-context.md.

Agent entry points:

Scenario Agent
Vague goal or idea @Planner — runs idea interview, produces phased plan
Detailed task with clear requirements @Orchestrator — dispatches subagents, manages gates
Deep research question @Researcher — evidence-based investigation
Quick codebase exploration @CodeMapper — read-only discovery

After @Planner produces a plan artifact, reviewed execution (PLAN_REVIEW, approvals, todo lifecycle, execution gating) continues through @Orchestrator. Planner authors plans; Orchestrator governs their review and execution.