chore(format): deno fmt on .forum/ files

This commit is contained in:
Tyler Gillispie 2026-08-29 11:28:38 -07:00
parent 679f6c0f47
commit 48503d03fd
25 changed files with 666 additions and 346 deletions

View File

@ -1,33 +1,37 @@
# Agent Forum v4 - Consolidated Master Tracker
This document serves as the single source of truth for all concepts, data structures, and operational mechanisms defined in the `agent-forum.md` architectural blueprint. It consolidates the high-level architecture with the granular implementation constraints previously split across satellite documentation.
This document serves as the single source of truth for all concepts, data
structures, and operational mechanisms defined in the `agent-forum.md`
architectural blueprint. It consolidates the high-level architecture with the
granular implementation constraints previously split across satellite
documentation.
The table below tracks the definition, required implementation details, and Proof of Concept (PoC) coverage status for every implementable aspect of the Git-native ecosystem.
The table below tracks the definition, required implementation details, and
Proof of Concept (PoC) coverage status for every implementable aspect of the
Git-native ecosystem.
| Concept / Structure | Category | Blueprint Ref | Key Implementation Details | PoC File | Status |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Protocol Buffers (Protobuf)** | Data Structure | Section 1 | Serialized binary state and telemetry designed for conversion-less, high-performance data transfer. | `protobuf_poc.ts` | ✅ |
| **Git Notes** | Embedded Storage | Section 1 | Requires `git log --show-notes="forum/reasoning"` to fetch JSON payloads containing reasoning, risk, and telemetry. | `git_storage_poc.ts` | ✅ |
| **Orphan Branches** | Embedded Storage | Section 1 | Isolated `forum/meta-state` branch tracking CI/CD, RTMs, and DAGs without sharing main branch commit history. | `orphan_branch_poc.ts` | ✅ |
| **sqlite-vec & TurboQuant** | Embedded DB | Section 1 | 2-bit to 4-bit LSH/HNSW compression resulting in highly portable indexes typically under 30MB. | `vector_db_poc.ts` | ✅ |
| **Multi-Vec Isolation** | Embedded DB | Section 1 | Domain-specific SQLite files (e.g., `docs_graph.sqlite` distinct from `telemetry_graph.sqlite`) to prevent semantic bleed. | `multi_vec_poc.ts` | ✅ |
| **Declarative Frontmatter** | Data Structure | Section 1 & 4 | MUST utilize UUIDv7 (time-ordered) to allow historical sorting and chronological sequence inference directly from the ID. | `frontmatter_poc.ts` | ✅ |
| **The Project DAG** | Governance Structure | Section 4 | YAML schema explicitly requiring `id`, `blocked_by`, `legacy_slug`, `status`, and `description` fields. | `dag_engine_poc.ts` | ✅ |
| **Transitions Matrix** | Governance Structure | Section 1 & 2 | JSON mapping in `transitions.json` strictly defining Bounded Model Checking rules (e.g., `"Coder": { "requires": ["Gatekeeper_Approval"] }`). | `state_machine_poc.ts` | ✅ |
| **The Constitution (AGENTS.md)** | Governance Structure | Section 3 | Target application stack dynamically bound to the repository to statically prevent hallucinated dependencies. | `constitution_poc.ts` | ✅ |
| **Orchestration Matrix** | Governance Structure | Section 3 | Strict definition of inputs, outputs, and primary directives for the 6 core agents. | `orchestration_matrix_poc.ts` | ✅ |
| **Execution Flywheel** | Process | Section 5 | Continuous 3-step feedback loop: Analyst updates protocols, Gatekeeper reads constraints, cycle resets. | `execution_flywheel_poc.ts` | ✅ |
| **Git Merkle DAG Diffing** | Data Structure | Section 2 | Relies on `git ls-tree` and `git diff-tree` hashes for zero-overhead, O(1) context updates. | `merkle_diff_poc.ts` | ✅ |
| **SCIP Indexes** | Data Structure | Section 2 | Lightweight database mapping code definitions and references, typically extracted via Tree-sitter. | `code_intelligence_poc.ts` | ✅ |
| **ASTs & CFGs** | Data Structure | Section 2 | JSON/XML mapping of variable execution paths utilized for deterministic security proofs. | `cfg_poc.ts` | ✅ |
| **Mutation & Adjacency** | Data Structure | Section 2 & 3 | Blast radius and coverage enforcement mappings generated by tools like Stryker and CodeSee. | `mutation_poc.ts` | ✅ |
| **Static Analysis Payloads** | Data Structure | Section 2 | Standardized JSON/XML metric outputs from industry tools like Semgrep and SonarQube. | `static_analysis_poc.ts` | ✅ |
| **Tool Sandbox** | Process | Appendix A | Safe local execution environment for CLI/WebAssembly binaries (Tree-sitter, Semgrep) respecting Bounded Model Checking constraints. | `tool_sandbox_poc.ts` | ✅ |
| **Automated Git Hooks** | Process | Section 2 | Native pre-commit hooks configured to automatically generate SCIP and AST index graphs prior to agent interaction. | `git_hooks_poc.ts` | ✅ |
| **Ontologies (JSON-LD)** | Data Structure | Section 4 | Embedded `@type: "Requirement"` blocks compiled to a mathematical `ontology.graph` file for deep traceability. | `ontology_poc.ts` | ✅ |
| **OTel Traces** | Data Structure | Section 4 | Standardized `.trace.json` payloads capturing millisecond-level execution latencies during testing. | `telemetry_poc.ts` | ✅ |
| **Team Friction Telemetry** | Data Structure | Section 4 | JSON payloads recorded in the meta-state branch tracking MTTR, PR comment-to-code ratios, and idle handoff durations. | `telemetry_poc.ts` | ✅ |
| **Doc-to-LoRA** | Dismissed Concept | Section 6 | Rejected because generating megabytes of `.safetensors` adapter weights directly causes extreme Git repository bloat. | `graveyard_poc.ts` | ❌ |
| **PASTE (Speculative Tooling)** | Dismissed Concept | Section 6 | Rejected because speculative write operations cause irrecoverable race conditions and corrupt the meta-state branch. | `graveyard_poc.ts` | ❌ |
| Concept / Structure | Category | Blueprint Ref | Key Implementation Details | PoC File | Status |
| :------------------------------- | :------------------- | :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------- | :----- |
| **Protocol Buffers (Protobuf)** | Data Structure | Section 1 | Serialized binary state and telemetry designed for conversion-less, high-performance data transfer. | `protobuf_poc.ts` | ✅ |
| **Git Notes** | Embedded Storage | Section 1 | Requires `git log --show-notes="forum/reasoning"` to fetch JSON payloads containing reasoning, risk, and telemetry. | `git_storage_poc.ts` | ✅ |
| **Orphan Branches** | Embedded Storage | Section 1 | Isolated `forum/meta-state` branch tracking CI/CD, RTMs, and DAGs without sharing main branch commit history. | `orphan_branch_poc.ts` | ✅ |
| **sqlite-vec & TurboQuant** | Embedded DB | Section 1 | 2-bit to 4-bit LSH/HNSW compression resulting in highly portable indexes typically under 30MB. | `vector_db_poc.ts` | ✅ |
| **Multi-Vec Isolation** | Embedded DB | Section 1 | Domain-specific SQLite files (e.g., `docs_graph.sqlite` distinct from `telemetry_graph.sqlite`) to prevent semantic bleed. | `multi_vec_poc.ts` | ✅ |
| **Declarative Frontmatter** | Data Structure | Section 1 & 4 | MUST utilize UUIDv7 (time-ordered) to allow historical sorting and chronological sequence inference directly from the ID. | `frontmatter_poc.ts` | ✅ |
| **The Project DAG** | Governance Structure | Section 4 | YAML schema explicitly requiring `id`, `blocked_by`, `legacy_slug`, `status`, and `description` fields. | `dag_engine_poc.ts` | ✅ |
| **Transitions Matrix** | Governance Structure | Section 1 & 2 | JSON mapping in `transitions.json` strictly defining Bounded Model Checking rules (e.g., `"Coder": { "requires": ["Gatekeeper_Approval"] }`). | `state_machine_poc.ts` | ✅ |
| **The Constitution (AGENTS.md)** | Governance Structure | Section 3 | Target application stack dynamically bound to the repository to statically prevent hallucinated dependencies. | `constitution_poc.ts` | ✅ |
| **Orchestration Matrix** | Governance Structure | Section 3 | Strict definition of inputs, outputs, and primary directives for the 6 core agents. | `orchestration_matrix_poc.ts` | ✅ |
| **Execution Flywheel** | Process | Section 5 | Continuous 3-step feedback loop: Analyst updates protocols, Gatekeeper reads constraints, cycle resets. | `execution_flywheel_poc.ts` | ✅ |
| **Git Merkle DAG Diffing** | Data Structure | Section 2 | Relies on `git ls-tree` and `git diff-tree` hashes for zero-overhead, O(1) context updates. | `merkle_diff_poc.ts` | ✅ |
| **SCIP Indexes** | Data Structure | Section 2 | Lightweight database mapping code definitions and references, typically extracted via Tree-sitter. | `code_intelligence_poc.ts` | ✅ |
| **ASTs & CFGs** | Data Structure | Section 2 | JSON/XML mapping of variable execution paths utilized for deterministic security proofs. | `cfg_poc.ts` | ✅ |
| **Mutation & Adjacency** | Data Structure | Section 2 & 3 | Blast radius and coverage enforcement mappings generated by tools like Stryker and CodeSee. | `mutation_poc.ts` | ✅ |
| **Static Analysis Payloads** | Data Structure | Section 2 | Standardized JSON/XML metric outputs from industry tools like Semgrep and SonarQube. | `static_analysis_poc.ts` | ✅ |
| **Tool Sandbox** | Process | Appendix A | Safe local execution environment for CLI/WebAssembly binaries (Tree-sitter, Semgrep) respecting Bounded Model Checking constraints. | `tool_sandbox_poc.ts` | ✅ |
| **Automated Git Hooks** | Process | Section 2 | Native pre-commit hooks configured to automatically generate SCIP and AST index graphs prior to agent interaction. | `git_hooks_poc.ts` | ✅ |
| **Ontologies (JSON-LD)** | Data Structure | Section 4 | Embedded `@type: "Requirement"` blocks compiled to a mathematical `ontology.graph` file for deep traceability. | `ontology_poc.ts` | ✅ |
| **OTel Traces** | Data Structure | Section 4 | Standardized `.trace.json` payloads capturing millisecond-level execution latencies during testing. | `telemetry_poc.ts` | ✅ |
| **Team Friction Telemetry** | Data Structure | Section 4 | JSON payloads recorded in the meta-state branch tracking MTTR, PR comment-to-code ratios, and idle handoff durations. | `telemetry_poc.ts` | ✅ |
| **Doc-to-LoRA** | Dismissed Concept | Section 6 | Rejected because generating megabytes of `.safetensors` adapter weights directly causes extreme Git repository bloat. | `graveyard_poc.ts` | ❌ |
| **PASTE (Speculative Tooling)** | Dismissed Concept | Section 6 | Rejected because speculative write operations cause irrecoverable race conditions and corrupt the meta-state branch. | `graveyard_poc.ts` | ❌ |

View File

@ -2,111 +2,226 @@
## **Git-Native Agent Collaboration Ecosystem**
This galactic report defines the architectural blueprint for a Git-native, hyper-efficient AI agent ecosystem. By constraining all state, memory, and tooling to the local repository, cloud SaaS dependencies are replaced with embedded data structures (Merkle DAGs, SCIP indexes, local vector graphs, YAML task DAGs). This creates a zero-latency, cryptographically immutable pipeline where AI agents interact with structural code physics and semantic ontologies rather than raw text.
This galactic report defines the architectural blueprint for a Git-native,
hyper-efficient AI agent ecosystem. By constraining all state, memory, and
tooling to the local repository, cloud SaaS dependencies are replaced with
embedded data structures (Merkle DAGs, SCIP indexes, local vector graphs, YAML
task DAGs). This creates a zero-latency, cryptographically immutable pipeline
where AI agents interact with structural code physics and semantic ontologies
rather than raw text.
## **1\. The Git-Native Forcing Function & Embedded Storage**
Constraining the state and tooling entirely within the repository format acts as a brilliant forcing function. It shifts the architecture from a "Cloud-Native" distributed system to a "Local-First / Git-Native" operating system. Removing third-party databases preserves project isolation and provides cryptographic immutability with zero-latency access.
Constraining the state and tooling entirely within the repository format acts as
a brilliant forcing function. It shifts the architecture from a "Cloud-Native"
distributed system to a "Local-First / Git-Native" operating system. Removing
third-party databases preserves project isolation and provides cryptographic
immutability with zero-latency access.
* **Memory Storage (Git Notes & Orphan Branches):**
* **Git Notes (refs/notes/commits):** Arbitrary metadata—such as JSON transcripts of an AI agent's decision-making process—is attached directly to a commit without altering the commit hash. The Historian agent can read git log \--show-notes="ai" to understand why a specific line of code was written, keeping the working directory clean.
* **The Meta-State Orphan Branch:** Ongoing project state, such as CI/CD telemetry and Requirements Traceability Matrices (RTM), is tracked in a parallel orphan branch. Agents commit dynamic state JSONs here, isolated within the same .git folder but completely separate from the main source code.
* **Serialization (JSON vs. Protocol Buffers):** While JSON is utilized for human-readable state tracking, engineering teams should evaluate Protocol Buffers (Protobuf) for high-performance, conversion-less data transfer between agents. Protobuf integrates natively with SCIP indexes and works in tandem with TurboQuant (which compresses the vector math), drastically reducing I/O latency.
**Impact:** Eliminates reliance on external databases while maintaining perfect, version-controlled state isolation.
* **Fuzzy Retrieval via Embedded Vector Search:**
* **sqlite-vec & TurboQuant:** Traditional databases require exact keyword matches, but Locality-Sensitive Hashing (LSH) and Hierarchical Navigable Small World (HNSW) algorithms compress high-dimensional concepts into binary hashes. Using the sqlite-vec extension with 2-bit to 4-bit "TurboQuant" quantization allows massive semantic knowledge (PRDs, ADRs) to be compressed into a tiny local file (often under 30MB). Agents can query these associative memories in milliseconds without network calls.
* **Multi-Vec Isolation:** Rather than dumping all embeddings into a single vector database, the meta-state branch should consider isolated sqlite-vec files (e.g., docs\_graph.sqlite and telemetry\_graph.sqlite). This "Multi-Vec" architecture prevents semantic bleed, ensuring a query about code performance does not cross-contaminate with team communication logs.
**Impact:** Reduces context window bloat and eliminates cloud database latency.
* **Protocols & Governance:**
* **Declarative Frontmatter:** Every Markdown artifact requires YAML frontmatter containing a unique UUID (Artifact-ID).
* **Bounded Model Checking (BMC):** A local state machine reads a static .agents/transitions.json file to dictate the execution pipeline. This ensures strict governance (e.g., "The Coder agent cannot run until the Gatekeeper agent has signed off").
- **Memory Storage (Git Notes & Orphan Branches):**
- **Git Notes (refs/notes/commits):** Arbitrary metadata—such as JSON
transcripts of an AI agent's decision-making process—is attached directly to
a commit without altering the commit hash. The Historian agent can read git
log \--show-notes="ai" to understand why a specific line of code was
written, keeping the working directory clean.
- **The Meta-State Orphan Branch:** Ongoing project state, such as CI/CD
telemetry and Requirements Traceability Matrices (RTM), is tracked in a
parallel orphan branch. Agents commit dynamic state JSONs here, isolated
within the same .git folder but completely separate from the main source
code.
- **Serialization (JSON vs. Protocol Buffers):** While JSON is utilized for
human-readable state tracking, engineering teams should evaluate Protocol
Buffers (Protobuf) for high-performance, conversion-less data transfer
between agents. Protobuf integrates natively with SCIP indexes and works in
tandem with TurboQuant (which compresses the vector math), drastically
reducing I/O latency.\
**Impact:** Eliminates reliance on external databases while maintaining
perfect, version-controlled state isolation.
- **Fuzzy Retrieval via Embedded Vector Search:**
- **sqlite-vec & TurboQuant:** Traditional databases require exact keyword
matches, but Locality-Sensitive Hashing (LSH) and Hierarchical Navigable
Small World (HNSW) algorithms compress high-dimensional concepts into binary
hashes. Using the sqlite-vec extension with 2-bit to 4-bit "TurboQuant"
quantization allows massive semantic knowledge (PRDs, ADRs) to be compressed
into a tiny local file (often under 30MB). Agents can query these
associative memories in milliseconds without network calls.
- **Multi-Vec Isolation:** Rather than dumping all embeddings into a single
vector database, the meta-state branch should consider isolated sqlite-vec
files (e.g., docs\_graph.sqlite and telemetry\_graph.sqlite). This
"Multi-Vec" architecture prevents semantic bleed, ensuring a query about
code performance does not cross-contaminate with team communication logs.\
**Impact:** Reduces context window bloat and eliminates cloud database
latency.
- **Protocols & Governance:**
- **Declarative Frontmatter:** Every Markdown artifact requires YAML
frontmatter containing a unique UUID (Artifact-ID).
- **Bounded Model Checking (BMC):** A local state machine reads a static
.agents/transitions.json file to dictate the execution pipeline. This
ensures strict governance (e.g., "The Coder agent cannot run until the
Gatekeeper agent has signed off").
## **2\. Structured Code Intelligence**
To prevent context window collapse and massive compute costs, agents must not ingest raw text. Instead, they require a highly efficient I/O pipeline built on structured code intelligence.
To prevent context window collapse and massive compute costs, agents must not
ingest raw text. Instead, they require a highly efficient I/O pipeline built on
structured code intelligence.
* **Git Merkle DAG Diffing:** Because Git is fundamentally a Merkle Tree, the system uses zero-overhead diffing (git ls-tree and git diff-tree) to instantly identify changed file hashes. The AI's knowledge base updates in milliseconds by walking down the tree to the exact modified file.
**Impact:** Guarantees O(1) context updates by passing only cryptographic diffs rather than full file strings.
* **From Syntax to Code Property Graphs (CPGs):**
* **Tree-sitter & SCIP Indexes:** Instead of regex, Tree-sitter incrementally parses code into a structured Abstract Syntax Tree (AST). A pre-commit hook then generates a SCIP (Semantic Code Intelligence Protocol) index—a lightweight database of code symbols providing statically guaranteed "Find References" and "Go to Definition" capabilities.
* **Control Flow Graphs (CFGs):** Extracted from the AST, CFGs map every possible path a variable can take. The Adversary agent can feed this JSON dataset into its prompt to deterministically prove if unsanitized user input can ever reach a database query.
**Impact:** Transforms ambiguous text processing into deterministic, mathematically verifiable graph traversals.
* **Human-Grade Quality Tools:** Agents ingest the JSON/XML outputs of industry-standard tools:
* **Static Analysis (Semgrep / SonarQube):** Feeds vulnerabilities and code smells directly to triage agents.
* **Mutation Testing (Stryker / Mutmut):** Injects bugs to test the tests. Feeding mutation scores to the Adversary agent forces the generation of edge-case coverage rather than superficial line-coverage.
* **Dependency Graphing (CodeSee / Madge):** Generates adjacency matrices to calculate the exact "blast radius" of a code change.
**Impact:** Roots agent decision-making in industry-standard, compiler-grade telemetry rather than LLM guesswork.
- **Git Merkle DAG Diffing:** Because Git is fundamentally a Merkle Tree, the
system uses zero-overhead diffing (git ls-tree and git diff-tree) to instantly
identify changed file hashes. The AI's knowledge base updates in milliseconds
by walking down the tree to the exact modified file.\
**Impact:** Guarantees O(1) context updates by passing only cryptographic
diffs rather than full file strings.
- **From Syntax to Code Property Graphs (CPGs):**
- **Tree-sitter & SCIP Indexes:** Instead of regex, Tree-sitter incrementally
parses code into a structured Abstract Syntax Tree (AST). A pre-commit hook
then generates a SCIP (Semantic Code Intelligence Protocol) index—a
lightweight database of code symbols providing statically guaranteed "Find
References" and "Go to Definition" capabilities.
- **Control Flow Graphs (CFGs):** Extracted from the AST, CFGs map every
possible path a variable can take. The Adversary agent can feed this JSON
dataset into its prompt to deterministically prove if unsanitized user input
can ever reach a database query.\
**Impact:** Transforms ambiguous text processing into deterministic,
mathematically verifiable graph traversals.
- **Human-Grade Quality Tools:** Agents ingest the JSON/XML outputs of
industry-standard tools:
- **Static Analysis (Semgrep / SonarQube):** Feeds vulnerabilities and code
smells directly to triage agents.
- **Mutation Testing (Stryker / Mutmut):** Injects bugs to test the tests.
Feeding mutation scores to the Adversary agent forces the generation of
edge-case coverage rather than superficial line-coverage.
- **Dependency Graphing (CodeSee / Madge):** Generates adjacency matrices to
calculate the exact "blast radius" of a code change.\
**Impact:** Roots agent decision-making in industry-standard, compiler-grade
telemetry rather than LLM guesswork.
## **3\. Orchestration Matrix & Governance**
The AGENTS.md file serves as the strict, machine-readable constitution. To ensure agent autonomy, instructions must rely on this repository documentation rather than micromanaging or spoon-feeding step-by-step logic in individual system prompts.
The AGENTS.md file serves as the strict, machine-readable constitution. To
ensure agent autonomy, instructions must rely on this repository documentation
rather than micromanaging or spoon-feeding step-by-step logic in individual
system prompts.
| Role | Inputs | Outputs | Primary Directive |
| :---- | :---- | :---- | :---- |
| **Gatekeeper** | Ontologies, YAML DAGs | Verification checklists | Bridge human requirements with technical reality. |
| **Historian** | sqlite-vec, Git Notes | Contextual injection | Prevent regression and historical repetition. |
| **Adversary** | SCIP graphs, CFGs, Mutation, OTel Traces | Edge-case tests, mutations, bottlenecks | Expose security flaws, enforce test coverage, and identify execution bottlenecks. |
| **Translator** | SCIP diffs, existing docs | API references, guides | Maintain code-to-documentation parity. |
| **Analyst** | Telemetry, PR threads | Workflow optimizations, Protocol updates | Optimize human-to-agent collaboration. |
| **Evaluator** | transitions.json, DAGs | Pipeline progression | Govern pipeline integrity (R/W access to meta-state). |
| Role | Inputs | Outputs | Primary Directive |
| :------------- | :--------------------------------------- | :--------------------------------------- | :-------------------------------------------------------------------------------- |
| **Gatekeeper** | Ontologies, YAML DAGs | Verification checklists | Bridge human requirements with technical reality. |
| **Historian** | sqlite-vec, Git Notes | Contextual injection | Prevent regression and historical repetition. |
| **Adversary** | SCIP graphs, CFGs, Mutation, OTel Traces | Edge-case tests, mutations, bottlenecks | Expose security flaws, enforce test coverage, and identify execution bottlenecks. |
| **Translator** | SCIP diffs, existing docs | API references, guides | Maintain code-to-documentation parity. |
| **Analyst** | Telemetry, PR threads | Workflow optimizations, Protocol updates | Optimize human-to-agent collaboration. |
| **Evaluator** | transitions.json, DAGs | Pipeline progression | Govern pipeline integrity (R/W access to meta-state). |
### **The Adversary's Expanded Scope**
Traditionally associated solely with security, this agent wears three distinct hats to comprehensively stress-test the repository:
Traditionally associated solely with security, this agent wears three distinct
hats to comprehensively stress-test the repository:
1. **The Security Auditor:** Feeds on Control Flow Graphs (CFGs) to deterministically prove if unsanitized user input reaches database queries.
2. **The Quality Engineer:** Consumes mutation scores (from Stryker/Mutmut) to hunt for edge cases and enforce strict test coverage.
3. **The Performance Engineer:** Ingests OpenTelemetry .trace.json files from Section 4 to identify real-world execution bottlenecks.
1. **The Security Auditor:** Feeds on Control Flow Graphs (CFGs) to
deterministically prove if unsanitized user input reaches database queries.
2. **The Quality Engineer:** Consumes mutation scores (from Stryker/Mutmut) to
hunt for edge cases and enforce strict test coverage.
3. **The Performance Engineer:** Ingests OpenTelemetry .trace.json files from
Section 4 to identify real-world execution bottlenecks.
### **Target Application Stack Boundaries**
The operational technology stack is strictly and dynamically defined by the repository's AGENTS.md (The Constitution). Agents are mathematically bound to the stack declared in this file. By locking in the stack at the repository level, agents are statically prevented from hallucinating unauthorized libraries, frameworks, legacy dependencies, or unapproved languages into the codebase.
The operational technology stack is strictly and dynamically defined by the
repository's AGENTS.md (The Constitution). Agents are mathematically bound to
the stack declared in this file. By locking in the stack at the repository
level, agents are statically prevented from hallucinating unauthorized
libraries, frameworks, legacy dependencies, or unapproved languages into the
codebase.
## **4\. Semantic Project Management & Telemetry**
By mapping the syntactic structure of code to the semantic structure of a project, the system establishes concrete datasets that act as the connective tissue between code, schedules, and business logic.
By mapping the syntactic structure of code to the semantic structure of a
project, the system establishes concrete datasets that act as the connective
tissue between code, schedules, and business logic.
* **Replacing Jira (The Project DAG):** Project stories are serialized into the meta-state branch as strict YAML DAGs (e.g., Task\_44 explicitly declares blocked\_by: \[Task\_42, Task\_43\]). On every commit, the Evaluator agent reads the DAG to calculate the critical path, unblocking tasks and preventing agents from executing code out of order.
* **Replacing DOORS (The Ontology):** Deep traceability is achieved by embedding JSON-LD (Linked Data) blocks at the top of markdown documents (@type: "Requirement"). A script compiles these into a single ontology.graph file. Agents query this graph mathematically to find all components with relationship edges to specific business requirements.
* **Execution Traces (The Physics):** OpenTelemetry (OTel) traces are generated during test runs as .trace.json files, capturing millisecond execution latency. The Adversary agent uses this to understand how the code actually runs, identifying bottlenecks with precision.
* **Communication Telemetry:** The Analyst consumes specific metrics—Mean Time to Resolution (MTTR), PR Comment-to-Code Ratio, Idle Handoff Duration, Artifact Override Frequency, and Thread Friction Markers—serialized as JSON payloads in the meta-state branch to map team friction.
- **Replacing Jira (The Project DAG):** Project stories are serialized into the
meta-state branch as strict YAML DAGs (e.g., Task\_44 explicitly declares
blocked\_by: \[Task\_42, Task\_43\]). On every commit, the Evaluator agent
reads the DAG to calculate the critical path, unblocking tasks and preventing
agents from executing code out of order.
- **Replacing DOORS (The Ontology):** Deep traceability is achieved by embedding
JSON-LD (Linked Data) blocks at the top of markdown documents (@type:
"Requirement"). A script compiles these into a single ontology.graph file.
Agents query this graph mathematically to find all components with
relationship edges to specific business requirements.
- **Execution Traces (The Physics):** OpenTelemetry (OTel) traces are generated
during test runs as .trace.json files, capturing millisecond execution
latency. The Adversary agent uses this to understand how the code actually
runs, identifying bottlenecks with precision.
- **Communication Telemetry:** The Analyst consumes specific metrics—Mean Time
to Resolution (MTTR), PR Comment-to-Code Ratio, Idle Handoff Duration,
Artifact Override Frequency, and Thread Friction Markers—serialized as JSON
payloads in the meta-state branch to map team friction.
## **5\. The Execution Pipeline**
The entire system operates as a continuous, structured data flywheel. All artifacts are embedded into the local database, providing agents with a perfect, multi-dimensional understanding of the repository.
The entire system operates as a continuous, structured data flywheel. All
artifacts are embedded into the local database, providing agents with a perfect,
multi-dimensional understanding of the repository.
To visualize this flow, the five core stages of the pipeline map directly to the artifacts they generate and the specific roles that consume them:
To visualize this flow, the five core stages of the pipeline map directly to the
artifacts they generate and the specific roles that consume them:
| | Artifact | Generated Data Structure | Primary Consumer Role |
| :---- | :---- | :---- | :---- |
| **1\.** | **The Code** (Architecture) | SCIP/ASTs | Adversary / Translator |
| **2\.** | **The Tests** (Physics) | OTel Traces | Adversary |
| **3\.** | **The Docs** (Business Logic) | JSON-LD Ontologies | Gatekeeper |
| **4\.** | **The Process** (Schedule) | YAML DAGs | Evaluator |
| **5\.** | **The Team** (Friction) | JSON Telemetry | Analyst |
| | Artifact | Generated Data Structure | Primary Consumer Role |
| :------ | :---------------------------- | :----------------------- | :--------------------- |
| **1\.** | **The Code** (Architecture) | SCIP/ASTs | Adversary / Translator |
| **2\.** | **The Tests** (Physics) | OTel Traces | Adversary |
| **3\.** | **The Docs** (Business Logic) | JSON-LD Ontologies | Gatekeeper |
| **4\.** | **The Process** (Schedule) | YAML DAGs | Evaluator |
| **5\.** | **The Team** (Friction) | JSON Telemetry | Analyst |
This pipeline is not a linear checklist; it is a continuous, self-correcting feedback loop. As demonstrated above, Step 5 (The Team generates Telemetry) feeds directly back into Step 1 to optimize the next pass:
This pipeline is not a linear checklist; it is a continuous, self-correcting
feedback loop. As demonstrated above, Step 5 (The Team generates Telemetry)
feeds directly back into Step 1 to optimize the next pass:
1. The **Analyst** interprets telemetry to update project protocols.
2. The **Gatekeeper** reads these new protocols to constrain the next cycle.
1. The **Analyst** interprets telemetry to update project protocols.
2. The **Gatekeeper** reads these new protocols to constrain the next cycle.
3. The loop resets, returning to code generation with updated guardrails.
## **6\. Filtered Explorations (Architectural Graveyard)**
During the design phase, several bleeding-edge tools were evaluated but ultimately altered to respect the strict repo-native constraints.
During the design phase, several bleeding-edge tools were evaluated but
ultimately altered to respect the strict repo-native constraints.
* **Doc-to-LoRA (D2L) Hypernetworks:** A Perceiver-based latent mapping system designed to internalize external context by generating LoRA weights in a single forward pass, eliminating KV-cache overhead.
* *The Verdict:* While incredibly fast for inference, committing thousands of .safetensors adapter weights to Git would inevitably bloat the repository. D2L was swapped out in favor of context-caching via sqlite-vec.
* **PASTE (Pattern-Aware Speculative Tool Execution):** A framework that predicts tool calls using historical patterns and executes them while the LLM is still generating to achieve near-zero latency.
* *The Verdict:* Highly valuable for meta-routing, but its implementation requires careful tuning to ensure speculative executions do not violate the local computing and Bounded Model Checking constraints of the repository graph.
- **Doc-to-LoRA (D2L) Hypernetworks:** A Perceiver-based latent mapping system
designed to internalize external context by generating LoRA weights in a
single forward pass, eliminating KV-cache overhead.
- _The Verdict:_ While incredibly fast for inference, committing thousands of
.safetensors adapter weights to Git would inevitably bloat the repository.
D2L was swapped out in favor of context-caching via sqlite-vec.
- **PASTE (Pattern-Aware Speculative Tool Execution):** A framework that
predicts tool calls using historical patterns and executes them while the LLM
is still generating to achieve near-zero latency.
- _The Verdict:_ Highly valuable for meta-routing, but its implementation
requires careful tuning to ensure speculative executions do not violate the
local computing and Bounded Model Checking constraints of the repository
graph.
## **Appendix A: Example Toolchain Catalog**
To extract the structured data required by the AI agents, the following external utilities serve as strong baseline candidates. Engineering teams are explicitly encouraged to expand or substitute this catalog as new tools emerge or specific disciplinary datasets are required. While the underlying data structure requirements are strictly governed, tool choice remains highly flexible—custom integrations and alternative products are welcome provided they satisfy the deterministic extraction goals of the pipeline.
To extract the structured data required by the AI agents, the following external
utilities serve as strong baseline candidates. Engineering teams are explicitly
encouraged to expand or substitute this catalog as new tools emerge or specific
disciplinary datasets are required. While the underlying data structure
requirements are strictly governed, tool choice remains highly flexible—custom
integrations and alternative products are welcome provided they satisfy the
deterministic extraction goals of the pipeline.
* **Syntax & Architecture (SCIP/AST Extraction):** Tree-sitter (Local WebAssembly binaries for generating Abstract Syntax Trees) and SCIP CLI (Generates the Semantic Code Intelligence Protocol graphs).
* **Security & Static Analysis:** Semgrep / SonarQube (Compiles vulnerabilities and code smells into JSON payloads for the Adversary).
* **Quality & Mutation Testing:** Stryker / Mutmut (Injects bugs during the CI cycle to generate edge-case mutation scores).
* **Physics & Telemetry:** OpenTelemetry / OTel (Extracts millisecond execution latency into .trace.json files).
* **Dependency & Blast Radius:** CodeSee / Madge (Generates adjacency matrices to map downstream impact of code changes).
* **Data Storage & Retrieval:** sqlite-vec (Embedded SQLite extensions handling local vector indexing and TurboQuant compression).
- **Syntax & Architecture (SCIP/AST Extraction):** Tree-sitter (Local
WebAssembly binaries for generating Abstract Syntax Trees) and SCIP CLI
(Generates the Semantic Code Intelligence Protocol graphs).
- **Security & Static Analysis:** Semgrep / SonarQube (Compiles vulnerabilities
and code smells into JSON payloads for the Adversary).
- **Quality & Mutation Testing:** Stryker / Mutmut (Injects bugs during the CI
cycle to generate edge-case mutation scores).
- **Physics & Telemetry:** OpenTelemetry / OTel (Extracts millisecond execution
latency into .trace.json files).
- **Dependency & Blast Radius:** CodeSee / Madge (Generates adjacency matrices
to map downstream impact of code changes).
- **Data Storage & Retrieval:** sqlite-vec (Embedded SQLite extensions handling
local vector indexing and TurboQuant compression).

View File

@ -1,9 +1,17 @@
# Generation 1 Constraints: Mocked, Isolated, In-Memory
The Proofs of Concept (PoCs) in this directory (`forum/poc-g1/`) are bound by strict Generation 1 constraints:
The Proofs of Concept (PoCs) in this directory (`forum/poc-g1/`) are bound by
strict Generation 1 constraints:
1. **Isolation:** They must have absolutely minimal effect on the broader repository.
2. **Mocked Data:** They simulate interactions (e.g., via simple logic or static JSON returns) rather than executing heavy external binaries or writing to persistent disk.
3. **In-Memory State:** They operate predominantly in memory, validating the mathematical and logical feasibility of the concepts (e.g., dependency traversal, state machine bounds, semantic match simulation) without requiring a complex production environment setup.
1. **Isolation:** They must have absolutely minimal effect on the broader
repository.
2. **Mocked Data:** They simulate interactions (e.g., via simple logic or static
JSON returns) rather than executing heavy external binaries or writing to
persistent disk.
3. **In-Memory State:** They operate predominantly in memory, validating the
mathematical and logical feasibility of the concepts (e.g., dependency
traversal, state machine bounds, semantic match simulation) without requiring
a complex production environment setup.
These scripts validate the *theory and logic* of the architectural blueprint before scaling up to physical implementation constraints.
These scripts validate the _theory and logic_ of the architectural blueprint
before scaling up to physical implementation constraints.

View File

@ -22,11 +22,17 @@ async function runMockedFlywheel() {
constraintLevel: newConstraintLevel,
allowedTools: ["mock-linter", `mock-security-scanner-v${i}`],
};
console.log(`[Analyst] Updated protocol constraints: ${JSON.stringify(protocolState)}`);
console.log(
`[Analyst] Updated protocol constraints: ${
JSON.stringify(protocolState)
}`,
);
// Step 2: Gatekeeper reads constraints
console.log("[Gatekeeper] Reading new constraints...");
console.log(`[Gatekeeper] Enforcing constraint level: ${protocolState.constraintLevel}`);
console.log(
`[Gatekeeper] Enforcing constraint level: ${protocolState.constraintLevel}`,
);
// Step 3: Cycle resets / executes code generation against new constraints
console.log("[Coder] Generating code under current constraints...");

View File

@ -11,13 +11,17 @@ async function mockPreCommitHook() {
console.log("[Git Hook] Simulating extraction of modified files...");
const modifiedFiles = ["src/main.ts", "src/utils.ts"];
console.log(`[Git Hook] Generating SCIP and AST indexes for: ${modifiedFiles.join(', ')}`);
console.log(
`[Git Hook] Generating SCIP and AST indexes for: ${
modifiedFiles.join(", ")
}`,
);
const mockIndex = {
generatedAt: new Date().toISOString(),
filesIndexed: modifiedFiles.length,
status: "success",
symbolsFound: 42
symbolsFound: 42,
};
console.log("[Git Hook] Index generation complete.");

View File

@ -7,51 +7,60 @@
*/
function proveDocToLoRABloat() {
console.log("--- Proof 1: Doc-to-LoRA Git Bloat ---");
// Simulate size of a lightweight adapter file in bytes (e.g., 5MB)
const ADAPTER_SIZE_BYTES = 5 * 1024 * 1024;
const COMMITS_PER_DAY = 15;
const DAYS_IN_MONTH = 30;
console.log("--- Proof 1: Doc-to-LoRA Git Bloat ---");
// Simulate size of a lightweight adapter file in bytes (e.g., 5MB)
const ADAPTER_SIZE_BYTES = 5 * 1024 * 1024;
const COMMITS_PER_DAY = 15;
const DAYS_IN_MONTH = 30;
const monthlyBloat = (ADAPTER_SIZE_BYTES * COMMITS_PER_DAY * DAYS_IN_MONTH) / (1024 * 1024 * 1024); // in GB
const monthlyBloat = (ADAPTER_SIZE_BYTES * COMMITS_PER_DAY * DAYS_IN_MONTH) /
(1024 * 1024 * 1024); // in GB
console.log(`Simulating Doc-to-LoRA generation per commit...`);
console.log(`Adapter Size: 5MB | Commits/Day: ${COMMITS_PER_DAY}`);
console.log(`Projected Monthly Git Blob Accumulation: ${monthlyBloat.toFixed(2)} GB`);
console.log(`Simulating Doc-to-LoRA generation per commit...`);
console.log(`Adapter Size: 5MB | Commits/Day: ${COMMITS_PER_DAY}`);
console.log(
`Projected Monthly Git Blob Accumulation: ${monthlyBloat.toFixed(2)} GB`,
);
if (monthlyBloat > 1.0) {
console.log("❌ REJECTED: Repository size exceeds portability constraints.");
}
if (monthlyBloat > 1.0) {
console.log(
"❌ REJECTED: Repository size exceeds portability constraints.",
);
}
}
function provePASTEViolation() {
console.log("\n--- Proof 2: PASTE Speculative Execution Violation ---");
console.log("\n--- Proof 2: PASTE Speculative Execution Violation ---");
// Simulate a deterministic state machine
const stateMachine = {
currentState: "PLANNING",
allowedNext: ["GATEKEEPER_REVIEW"]
};
// Simulate a deterministic state machine
const stateMachine = {
currentState: "PLANNING",
allowedNext: ["GATEKEEPER_REVIEW"],
};
// PASTE attempts to speculatively execute a tool call for the *next* phase
const speculativeAction = "COMMIT_CODE";
// PASTE attempts to speculatively execute a tool call for the *next* phase
const speculativeAction = "COMMIT_CODE";
console.log(`Current State: ${stateMachine.currentState}`);
console.log(`PASTE attempts speculative action: ${speculativeAction}`);
console.log(`Current State: ${stateMachine.currentState}`);
console.log(`PASTE attempts speculative action: ${speculativeAction}`);
if (!stateMachine.allowedNext.includes(speculativeAction)) {
console.log(`❌ REJECTED: Speculative execution violated Bounded Model Checking. '${speculativeAction}' is not an allowed transition from '${stateMachine.currentState}'.`);
} else {
console.error(`Error: Expected PASTE to fail the transition check.`);
Deno.exit(1);
}
if (!stateMachine.allowedNext.includes(speculativeAction)) {
console.log(
`❌ REJECTED: Speculative execution violated Bounded Model Checking. '${speculativeAction}' is not an allowed transition from '${stateMachine.currentState}'.`,
);
} else {
console.error(`Error: Expected PASTE to fail the transition check.`);
Deno.exit(1);
}
}
function runPoC() {
console.log("Running Architectural Graveyard Anti-PoC tests...\n");
proveDocToLoRABloat();
provePASTEViolation();
console.log("\n✅ Architectural Graveyard Anti-PoC successful: Dismissed concepts mathematically and logically proven invalid.");
console.log(
"\n✅ Architectural Graveyard Anti-PoC successful: Dismissed concepts mathematically and logically proven invalid.",
);
}
if (import.meta.main) {

View File

@ -128,8 +128,7 @@ const EXPERIMENTS = [
{
name: "Execution Flywheel PoC",
file: "execution_flywheel_poc.ts",
description:
"Verifies continuous 3-step feedback loop purely in-memory.",
description: "Verifies continuous 3-step feedback loop purely in-memory.",
},
{
name: "Tool Sandbox PoC",

View File

@ -20,17 +20,17 @@ class MockVectorDB {
}
// Simplified cosine similarity mock
query(vector: number[]): { id: string, score: number }[] {
query(vector: number[]): { id: string; score: number }[] {
const results = [];
for (const [id, vec] of this.data.entries()) {
// In a real scenario, this is mathematically calculating cosine similarity
// For the PoC, we just check if it's the exact same vector for a 1.0 score
const isExactMatch = vector.every((val, i) => val === vec[i]);
if (isExactMatch) {
results.push({ id, score: 1.0 });
results.push({ id, score: 1.0 });
} else {
// Mock random low score for non-matches
results.push({ id, score: 0.1 });
// Mock random low score for non-matches
results.push({ id, score: 0.1 });
}
}
return results.sort((a, b) => b.score - a.score);
@ -58,25 +58,31 @@ function runPoC() {
const docsResult = docsDb.query(authDocVector);
if (docsResult[0].id === "doc_auth_guide" && docsResult[0].score > 0.8) {
console.log(`✅ Found relevant doc in ${docsDb.name}`);
console.log(`✅ Found relevant doc in ${docsDb.name}`);
} else {
console.error(`❌ Failed to find doc in ${docsDb.name}`);
Deno.exit(1);
console.error(`❌ Failed to find doc in ${docsDb.name}`);
Deno.exit(1);
}
// 4. Prove Semantic Isolation (No Bleed)
// If we query the Telemetry DB with an architecture question, it should NOT return telemetry data
console.log(`Querying ${telemetryDb.name} with architecture context to prove isolation...`);
console.log(
`Querying ${telemetryDb.name} with architecture context to prove isolation...`,
);
const isolatedResult = telemetryDb.query(authDocVector);
if (isolatedResult[0].score < 0.5) {
console.log(`✅ Semantic isolation confirmed. Telemetry DB did not return high confidence for a docs query.`);
console.log(
`✅ Semantic isolation confirmed. Telemetry DB did not return high confidence for a docs query.`,
);
} else {
console.error(`❌ Semantic bleed detected!`);
Deno.exit(1);
console.error(`❌ Semantic bleed detected!`);
Deno.exit(1);
}
console.log("✅ Multi-Vec Isolation PoC successful: Domain-specific semantic bleed prevented.");
console.log(
"✅ Multi-Vec Isolation PoC successful: Domain-specific semantic bleed prevented.",
);
}
if (import.meta.main) {

View File

@ -8,36 +8,37 @@
// Define the Orchestration Matrix
const OrchestrationMatrix = {
"Gatekeeper": {
inputs: ["Ontologies", "YAML DAGs"],
outputs: ["Verification checklists"],
directive: "Bridge human requirements with technical reality."
},
"Historian": {
inputs: ["sqlite-vec", "Git Notes"],
outputs: ["Contextual injection"],
directive: "Prevent regression and historical repetition."
},
"Adversary": {
inputs: ["SCIP graphs", "CFGs", "Mutation", "OTel Traces"],
outputs: ["Edge-case tests", "mutations", "bottlenecks"],
directive: "Expose security flaws, enforce test coverage, and identify execution bottlenecks."
},
"Translator": {
inputs: ["SCIP diffs", "existing docs"],
outputs: ["API references", "guides"],
directive: "Maintain code-to-documentation parity."
},
"Analyst": {
inputs: ["Telemetry", "PR threads"],
outputs: ["Workflow optimizations", "Protocol updates"],
directive: "Optimize human-to-agent collaboration."
},
"Evaluator": {
inputs: ["transitions.json", "DAGs"],
outputs: ["Pipeline progression"],
directive: "Govern pipeline integrity (R/W access to meta-state)."
}
"Gatekeeper": {
inputs: ["Ontologies", "YAML DAGs"],
outputs: ["Verification checklists"],
directive: "Bridge human requirements with technical reality.",
},
"Historian": {
inputs: ["sqlite-vec", "Git Notes"],
outputs: ["Contextual injection"],
directive: "Prevent regression and historical repetition.",
},
"Adversary": {
inputs: ["SCIP graphs", "CFGs", "Mutation", "OTel Traces"],
outputs: ["Edge-case tests", "mutations", "bottlenecks"],
directive:
"Expose security flaws, enforce test coverage, and identify execution bottlenecks.",
},
"Translator": {
inputs: ["SCIP diffs", "existing docs"],
outputs: ["API references", "guides"],
directive: "Maintain code-to-documentation parity.",
},
"Analyst": {
inputs: ["Telemetry", "PR threads"],
outputs: ["Workflow optimizations", "Protocol updates"],
directive: "Optimize human-to-agent collaboration.",
},
"Evaluator": {
inputs: ["transitions.json", "DAGs"],
outputs: ["Pipeline progression"],
directive: "Govern pipeline integrity (R/W access to meta-state).",
},
};
function runPoC() {
@ -53,21 +54,42 @@ function runPoC() {
let selectedAgent = null;
for (const [role, definition] of Object.entries(OrchestrationMatrix)) {
if (definition.outputs.some(out => out.includes("tests") || out.includes("bottlenecks") || out.includes("mutations"))) {
selectedAgent = role;
break;
}
if (
definition.outputs.some((out) =>
out.includes("tests") || out.includes("bottlenecks") ||
out.includes("mutations")
)
) {
selectedAgent = role;
break;
}
}
if (selectedAgent === "Adversary") {
console.log(`✅ Correctly routed to: ${selectedAgent}`);
console.log(` Inputs allowed: ${OrchestrationMatrix[selectedAgent].inputs.join(", ")}`);
console.log(` Expected Outputs: ${OrchestrationMatrix[selectedAgent].outputs.join(", ")}`);
console.log(` Primary Directive Enforced: ${OrchestrationMatrix[selectedAgent].directive}\n`);
console.log("✅ Orchestration Matrix PoC successful: Agents logically constrained to defined roles and I/O boundaries.");
console.log(`✅ Correctly routed to: ${selectedAgent}`);
console.log(
` Inputs allowed: ${
OrchestrationMatrix[selectedAgent].inputs.join(", ")
}`,
);
console.log(
` Expected Outputs: ${
OrchestrationMatrix[selectedAgent].outputs.join(", ")
}`,
);
console.log(
` Primary Directive Enforced: ${
OrchestrationMatrix[selectedAgent].directive
}\n`,
);
console.log(
"✅ Orchestration Matrix PoC successful: Agents logically constrained to defined roles and I/O boundaries.",
);
} else {
console.error(`❌ Routing failed. Expected 'Adversary', got '${selectedAgent}'`);
Deno.exit(1);
console.error(
`❌ Routing failed. Expected 'Adversary', got '${selectedAgent}'`,
);
Deno.exit(1);
}
}

View File

@ -15,9 +15,10 @@ const mockSemgrepPayload = {
"start": { "line": 45, "col": 5 },
"end": { "line": 45, "col": 40 },
"extra": {
"message": "Potential XSS vulnerability: user input is reflected without sanitization.",
"severity": "ERROR"
}
"message":
"Potential XSS vulnerability: user input is reflected without sanitization.",
"severity": "ERROR",
},
},
{
"check_id": "typescript.react.best-practice.react-props-no-spreading",
@ -25,12 +26,13 @@ const mockSemgrepPayload = {
"start": { "line": 12, "col": 10 },
"end": { "line": 12, "col": 25 },
"extra": {
"message": "Prop spreading is discouraged as it obscures the component API.",
"severity": "WARNING"
}
}
"message":
"Prop spreading is discouraged as it obscures the component API.",
"severity": "WARNING",
},
},
],
"errors": []
"errors": [],
};
function runPoC() {
@ -39,27 +41,35 @@ function runPoC() {
// Simulate an agent processing the structured payload
const criticalIssues = mockSemgrepPayload.results.filter(
(issue) => issue.extra.severity === "ERROR"
(issue) => issue.extra.severity === "ERROR",
);
const warnings = mockSemgrepPayload.results.filter(
(issue) => issue.extra.severity === "WARNING"
(issue) => issue.extra.severity === "WARNING",
);
console.log(`\nAdversary Agent Analysis:`);
console.log(`- Found ${criticalIssues.length} CRITICAL vulnerability.`);
if (criticalIssues.length > 0) {
console.log(` -> Action required on ${criticalIssues[0].path} line ${criticalIssues[0].start.line}: ${criticalIssues[0].extra.message}`);
console.log(
` -> Action required on ${criticalIssues[0].path} line ${
criticalIssues[0].start.line
}: ${criticalIssues[0].extra.message}`,
);
}
console.log(`- Found ${warnings.length} code smell/warning.`);
if (criticalIssues.length === 1 && criticalIssues[0].check_id.includes("xss")) {
console.log("\n✅ Static Analysis Payloads PoC successful: Structured compiler-grade metrics successfully ingested and triaged.");
if (
criticalIssues.length === 1 && criticalIssues[0].check_id.includes("xss")
) {
console.log(
"\n✅ Static Analysis Payloads PoC successful: Structured compiler-grade metrics successfully ingested and triaged.",
);
} else {
console.error("\n❌ Failed to process static analysis payload.");
Deno.exit(1);
console.error("\n❌ Failed to process static analysis payload.");
Deno.exit(1);
}
}

View File

@ -13,7 +13,10 @@ interface MockToolResult {
payload: any;
}
async function runMockTool(toolName: string, targetFile: string): Promise<MockToolResult> {
async function runMockTool(
toolName: string,
targetFile: string,
): Promise<MockToolResult> {
console.log(`[Sandbox] Mock executing ${toolName} on ${targetFile}...`);
if (toolName === "tree-sitter") {
@ -23,8 +26,8 @@ async function runMockTool(toolName: string, targetFile: string): Promise<MockTo
payload: {
astNode: "FunctionDeclaration",
name: "mockFunction",
lines: [1, 5]
}
lines: [1, 5],
},
};
} else if (toolName === "semgrep") {
return {
@ -35,10 +38,10 @@ async function runMockTool(toolName: string, targetFile: string): Promise<MockTo
{
id: "mock-sql-injection",
message: "Potential SQL injection detected",
line: 3
}
]
}
line: 3,
},
],
},
};
}
@ -49,10 +52,18 @@ async function runSandbox() {
console.log("Starting Mocked Tool Sandbox\n");
const astResult = await runMockTool("tree-sitter", "src/auth.ts");
console.log("Tree-sitter Mock Result:", JSON.stringify(astResult, null, 2), "\n");
console.log(
"Tree-sitter Mock Result:",
JSON.stringify(astResult, null, 2),
"\n",
);
const semgrepResult = await runMockTool("semgrep", "src/auth.ts");
console.log("Semgrep Mock Result:", JSON.stringify(semgrepResult, null, 2), "\n");
console.log(
"Semgrep Mock Result:",
JSON.stringify(semgrepResult, null, 2),
"\n",
);
console.log("Mocked Sandbox execution completed successfully.");
}

View File

@ -1,7 +1,17 @@
# Generation 2 Constraints: Production-Grade Tooling, Physical Limits
The Proofs of Concept (PoCs) in this directory (`forum/poc-g2/`) are designed to prove the physical feasibility of the architecture using **actual, production-ready tools**.
The Proofs of Concept (PoCs) in this directory (`forum/poc-g2/`) are designed to
prove the physical feasibility of the architecture using **actual,
production-ready tools**.
1. **No Faking:** We are explicitly not faking or mocking tools "to save on repo bloat." If the architecture calls for Tree-sitter or Semgrep, these PoCs must demonstrate their execution using actual binaries or WASM payloads.
2. **Physical File I/O:** These scripts interact with the actual filesystem (e.g., tracking states via real JSON files, parsing real Markdown or YAML, dynamically creating physical temp Git repos) to prove constraints.
3. **Architectural Validity:** If a required tool is too heavy or fundamentally incompatible with the Local-First/Git-Native bounds (as proven in the Graveyard PoC), it must be flagged for architectural reevaluation. The ability to run the real tool locally is the core pass/fail criterion of Gen 2.
1. **No Faking:** We are explicitly not faking or mocking tools "to save on repo
bloat." If the architecture calls for Tree-sitter or Semgrep, these PoCs must
demonstrate their execution using actual binaries or WASM payloads.
2. **Physical File I/O:** These scripts interact with the actual filesystem
(e.g., tracking states via real JSON files, parsing real Markdown or YAML,
dynamically creating physical temp Git repos) to prove constraints.
3. **Architectural Validity:** If a required tool is too heavy or fundamentally
incompatible with the Local-First/Git-Native bounds (as proven in the
Graveyard PoC), it must be flagged for architectural reevaluation. The
ability to run the real tool locally is the core pass/fail criterion of
Gen 2.

View File

@ -24,34 +24,36 @@ function calculateBlastRadius(info: any, targetFileUrl: string): string[] {
const reverseMap = new Map<string, string[]>();
if (info.modules) {
for (const mod of info.modules) {
const specifier = mod.specifier;
if (!reverseMap.has(specifier)) reverseMap.set(specifier, []);
for (const mod of info.modules) {
const specifier = mod.specifier;
if (!reverseMap.has(specifier)) reverseMap.set(specifier, []);
if (mod.dependencies) {
for (const dep of mod.dependencies) {
const importedSpecifier = dep.code?.specifier;
if (importedSpecifier) {
if (!reverseMap.has(importedSpecifier)) reverseMap.set(importedSpecifier, []);
reverseMap.get(importedSpecifier)!.push(specifier);
}
}
if (mod.dependencies) {
for (const dep of mod.dependencies) {
const importedSpecifier = dep.code?.specifier;
if (importedSpecifier) {
if (!reverseMap.has(importedSpecifier)) {
reverseMap.set(importedSpecifier, []);
}
reverseMap.get(importedSpecifier)!.push(specifier);
}
}
}
}
}
const impacted = new Set<string>();
const queue = [targetFileUrl];
while (queue.length > 0) {
const current = queue.shift()!;
const dependants = reverseMap.get(current) || [];
for (const dep of dependants) {
if (!impacted.has(dep)) {
impacted.add(dep);
queue.push(dep);
}
const current = queue.shift()!;
const dependants = reverseMap.get(current) || [];
for (const dep of dependants) {
if (!impacted.has(dep)) {
impacted.add(dep);
queue.push(dep);
}
}
}
return Array.from(impacted);
@ -69,8 +71,14 @@ if (import.meta.main) {
const fileA = path.join(dir, "A.ts");
await Deno.writeTextFile(fileC, "export const c = 1;");
await Deno.writeTextFile(fileB, "import { c } from './C.ts'; export const b = c + 1;");
await Deno.writeTextFile(fileA, "import { b } from './B.ts'; console.log(b);");
await Deno.writeTextFile(
fileB,
"import { c } from './C.ts'; export const b = c + 1;",
);
await Deno.writeTextFile(
fileA,
"import { b } from './B.ts'; console.log(b);",
);
const info = await getDenoDependencies(fileA);
const targetUrl = path.toFileUrl(fileC).href;
@ -78,14 +86,16 @@ if (import.meta.main) {
const blastRadius = calculateBlastRadius(info, targetUrl);
console.log(`If ${fileC} changes, the blast radius impacts:`);
blastRadius.forEach(b => console.log(` - ${b}`));
blastRadius.forEach((b) => console.log(` - ${b}`));
// B imports C, A imports B. Both should be impacted.
assertEquals(blastRadius.length, 2);
assertEquals(blastRadius.some(b => b.includes("B.ts")), true);
assertEquals(blastRadius.some(b => b.includes("A.ts")), true);
assertEquals(blastRadius.some((b) => b.includes("B.ts")), true);
assertEquals(blastRadius.some((b) => b.includes("A.ts")), true);
console.log("✅ Dependency Graphing PoC (Gen 2) successful: Real Deno dependency graph analyzed.");
console.log(
"✅ Dependency Graphing PoC (Gen 2) successful: Real Deno dependency graph analyzed.",
);
await Deno.remove(dir, { recursive: true });
} catch (err) {

View File

@ -6,7 +6,11 @@
* state between agents instead of purely in-memory objects.
*/
import { join, dirname, fromFileUrl } from "https://deno.land/std@0.224.0/path/mod.ts";
import {
dirname,
fromFileUrl,
join,
} from "https://deno.land/std@0.224.0/path/mod.ts";
const currentDir = dirname(fromFileUrl(import.meta.url));
const STATE_FILE = join(currentDir, "flywheel_state.json");
@ -41,13 +45,17 @@ async function runFlywheel() {
analystState.status = "ANALYST_UPDATED";
await writeState(analystState);
console.log(`[Analyst] State written to disk with constraint: ${newConstraintLevel}`);
console.log(
`[Analyst] State written to disk with constraint: ${newConstraintLevel}`,
);
// Step 2: Gatekeeper reads constraints from disk
console.log("[Gatekeeper] Reading updated constraints from disk...");
const gatekeeperState = await readState();
console.log(`[Gatekeeper] Enforcing constraint level: ${gatekeeperState.constraintLevel}`);
console.log(
`[Gatekeeper] Enforcing constraint level: ${gatekeeperState.constraintLevel}`,
);
gatekeeperState.status = "GATEKEEPER_APPROVED";
await writeState(gatekeeperState);

View File

@ -21,7 +21,7 @@ export function extractArtifactId(markdownContent: string): string {
// Extract YAML block strictly
const match = markdownContent.match(/^---\n([\s\S]*?)\n---/);
if (!match || !match[1]) {
throw new Error("No YAML frontmatter found");
throw new Error("No YAML frontmatter found");
}
// Parse YAML block with std/yaml
@ -79,8 +79,9 @@ Title: Legacy Task
}
assertEquals(failedAsExpected, true, "Should have rejected invalid UUID");
console.log("✅ Gen 2 Frontmatter PoC successful: Successfully rejected non-UUIDv7 artifact.");
console.log(
"✅ Gen 2 Frontmatter PoC successful: Successfully rejected non-UUIDv7 artifact.",
);
} catch (err) {
console.error("❌ Gen 2 Frontmatter PoC failed:", err);
Deno.exit(1);

View File

@ -6,9 +6,7 @@
* writes a real bash script to `.git/hooks/pre-commit`, and triggers a commit.
*/
import {
join,
} from "https://deno.land/std@0.224.0/path/mod.ts";
import { join } from "https://deno.land/std@0.224.0/path/mod.ts";
async function runCommand(cmd: string[], cwd: string): Promise<string> {
const command = new Deno.Command(cmd[0], {

View File

@ -52,7 +52,10 @@ export async function readGitNote(
try {
return await runGitCmd(["notes", "--ref", ref, "show", targetRef], cwd);
} catch (error: any) {
if (error.message.includes("No note found") || error.message.includes("does not exist")) {
if (
error.message.includes("No note found") ||
error.message.includes("does not exist")
) {
return "";
}
throw error;
@ -91,8 +94,9 @@ if (import.meta.main) {
const readMessage = await readGitNote(tempDir, customRef);
assertEquals(readMessage, testMessage);
console.log("✅ Gen 2 Git Storage PoC successful: Read/Write worked securely in an isolated Git environment.");
console.log(
"✅ Gen 2 Git Storage PoC successful: Read/Write worked securely in an isolated Git environment.",
);
} catch (err) {
console.error("❌ Gen 2 Git Storage PoC failed:", err);
Deno.exit(1);

View File

@ -16,27 +16,32 @@ const EXPERIMENTS = [
{
name: "DAG Engine PoC (Gen 2)",
file: "dag_engine_poc.ts",
description: "Verifies dependency resolution parsing real YAML task graphs.",
description:
"Verifies dependency resolution parsing real YAML task graphs.",
},
{
name: "Git Storage PoC (Gen 2)",
file: "git_storage_poc.ts",
description: "Verifies ability to read/write Git Notes in an isolated environment.",
description:
"Verifies ability to read/write Git Notes in an isolated environment.",
},
{
name: "Git Merkle DAG Diffing PoC (Gen 2)",
file: "merkle_diff_poc.ts",
description: "Verifies O(1) diffing using native Git tree hashes on an isolated history.",
description:
"Verifies O(1) diffing using native Git tree hashes on an isolated history.",
},
{
name: "Declarative Frontmatter PoC (Gen 2)",
file: "frontmatter_poc.ts",
description: "Verifies extraction of UUIDv7 from Markdown using real YAML parsing.",
description:
"Verifies extraction of UUIDv7 from Markdown using real YAML parsing.",
},
{
name: "Code Intelligence PoC (Gen 2)",
file: "code_intelligence_poc.ts",
description: "Verifies true Semantic Code graph structure extraction using AST parsing via acorn.",
description:
"Verifies true Semantic Code graph structure extraction using AST parsing via acorn.",
},
{
name: "CFG Security Proving PoC (Gen 2)",
@ -46,83 +51,99 @@ const EXPERIMENTS = [
{
name: "Static Analysis Payloads PoC (Gen 2)",
file: "static_analysis_poc.ts",
description: "Verifies real CI/CD integration using Deno.Command to run deno lint and parse JSON output.",
description:
"Verifies real CI/CD integration using Deno.Command to run deno lint and parse JSON output.",
},
{
name: "The Constitution PoC (Gen 2)",
file: "constitution_poc.ts",
description: "Verifies programmatic constraints parsing an actual markdown file.",
description:
"Verifies programmatic constraints parsing an actual markdown file.",
},
{
name: "Dependency Graphing PoC (Gen 2)",
file: "dependency_graph_poc.ts",
description: "Verifies calculating blast radius from a real Deno module dependency graph.",
description:
"Verifies calculating blast radius from a real Deno module dependency graph.",
},
{
name: "Ontology Traceability PoC (Gen 2)",
file: "ontology_poc.ts",
description: "Verifies JSON-LD semantic extraction from real markdown file I/O.",
description:
"Verifies JSON-LD semantic extraction from real markdown file I/O.",
},
{
name: "Orchestration Matrix PoC (Gen 2)",
file: "orchestration_matrix_poc.ts",
description: "Verifies programmatic routing via a real YAML matrix definition.",
description:
"Verifies programmatic routing via a real YAML matrix definition.",
},
{
name: "State Machine PoC (Gen 2)",
file: "state_machine_poc.ts",
description: "Verifies Bounded Model Checking rules loaded from filesystem.",
description:
"Verifies Bounded Model Checking rules loaded from filesystem.",
},
{
name: "Telemetry Parsing PoC (Gen 2)",
file: "telemetry_poc.ts",
description: "Verifies Analyst ingestion of real JSON telemetry payload files.",
description:
"Verifies Analyst ingestion of real JSON telemetry payload files.",
},
{
name: "Orphan Branch (Meta-State) PoC (Gen 2)",
file: "orphan_branch_poc.ts",
description: "Verifies absolute isolation of state data in an actual orphan branch.",
description:
"Verifies absolute isolation of state data in an actual orphan branch.",
},
{
name: "Mutation Testing PoC (Gen 2)",
file: "mutation_poc.ts",
description: "Verifies Adversary gate enforcement via structured mutation data files.",
description:
"Verifies Adversary gate enforcement via structured mutation data files.",
},
{
name: "Embedded Vector DB PoC (Gen 2)",
file: "vector_db_poc.ts",
description: "Verifies fuzzy semantic retrieval using real SQLite UDFs for vector math.",
description:
"Verifies fuzzy semantic retrieval using real SQLite UDFs for vector math.",
},
{
name: "Multi-Vec Isolation PoC (Gen 2)",
file: "multi_vec_poc.ts",
description: "Verifies cross-contamination prevention using physically isolated SQLite databases.",
description:
"Verifies cross-contamination prevention using physically isolated SQLite databases.",
},
{
name: "Protocol Buffers PoC (Gen 2)",
file: "protobuf_poc.ts",
description: "Verifies high-performance serialization using actual protobuf library.",
description:
"Verifies high-performance serialization using actual protobuf library.",
},
{
name: "Architectural Graveyard Anti-PoC (Gen 2)",
file: "graveyard_poc.ts",
description: "Mathematical proof of Local-First/Git-Native bounds violations.",
description:
"Mathematical proof of Local-First/Git-Native bounds violations.",
},
{
name: "Execution Flywheel PoC (Gen 2)",
file: "execution_flywheel_poc.ts",
description: "Verifies continuous feedback loop using physical file I/O for state tracking.",
description:
"Verifies continuous feedback loop using physical file I/O for state tracking.",
},
{
name: "Tool Sandbox PoC (Gen 2)",
file: "tool_sandbox_poc.ts",
description: "Verifies execution constraints using real binary tooling (Semgrep, Tree-sitter WASM).",
description:
"Verifies execution constraints using real binary tooling (Semgrep, Tree-sitter WASM).",
},
{
name: "Automated Git Hooks PoC (Gen 2)",
file: "git_hooks_poc.ts",
description: "Verifies programmatic generation of code indexes via native Git pre-commit hooks.",
}
description:
"Verifies programmatic generation of code indexes via native Git pre-commit hooks.",
},
];
async function runExperiment(
@ -156,8 +177,14 @@ async function runExperiment(
}
async function runLab() {
console.log(bold(blue("=== Agent Forum v4 - Experimental Laboratory (Generation 2) ===")));
console.log("Running advanced foundational proofs of concept with real production tools...\n");
console.log(
bold(
blue("=== Agent Forum v4 - Experimental Laboratory (Generation 2) ==="),
),
);
console.log(
"Running advanced foundational proofs of concept with real production tools...\n",
);
let passed = 0;
let failed = 0;

View File

@ -1,4 +1,7 @@
import { assertNotEquals, assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
import {
assertEquals,
assertNotEquals,
} from "https://deno.land/std@0.224.0/testing/asserts.ts";
/**
* Generation 2 Proof of Concept: Git Merkle DAG Diffing
@ -70,7 +73,9 @@ if (import.meta.main) {
"HEAD",
], tempDir);
console.log(`\nChanged files between HEAD~1 and HEAD (O(1) diffing):\n${diffTreeOutput}`);
console.log(
`\nChanged files between HEAD~1 and HEAD (O(1) diffing):\n${diffTreeOutput}`,
);
// Assert that only fileA.txt changed
assertEquals(diffTreeOutput, "fileA.txt");

View File

@ -11,38 +11,45 @@ import { assert } from "https://deno.land/std@0.224.0/testing/asserts.ts";
// Simulated output that would normally be generated by a mutation framework like Stryker
// We simulate loading it from a file
async function generateAndLoadMutationReport(filePath: string) {
await Deno.writeTextFile(filePath, JSON.stringify({
mutationScore: 65.4,
threshold: 80.0,
survivingMutants: [
{
file: "src/auth.ts",
line: 42,
mutator: "ConditionalExpression",
status: "Survived"
}
]
}));
await Deno.writeTextFile(
filePath,
JSON.stringify({
mutationScore: 65.4,
threshold: 80.0,
survivingMutants: [
{
file: "src/auth.ts",
line: 42,
mutator: "ConditionalExpression",
status: "Survived",
},
],
}),
);
return JSON.parse(await Deno.readTextFile(filePath));
return JSON.parse(await Deno.readTextFile(filePath));
}
function verifyQualityGate(report: any): { pass: boolean; feedback: string[] } {
const feedback = [];
if (report.mutationScore < report.threshold) {
feedback.push(`Mutation score ${report.mutationScore}% is below threshold ${report.threshold}%`);
const feedback = [];
if (report.mutationScore < report.threshold) {
feedback.push(
`Mutation score ${report.mutationScore}% is below threshold ${report.threshold}%`,
);
}
report.survivingMutants.forEach((mutant: any) => {
if (mutant.status === "Survived") {
feedback.push(
`Mutant survived in ${mutant.file}:${mutant.line} via ${mutant.mutator}. Add edge-case test.`,
);
}
});
report.survivingMutants.forEach((mutant: any) => {
if (mutant.status === "Survived") {
feedback.push(`Mutant survived in ${mutant.file}:${mutant.line} via ${mutant.mutator}. Add edge-case test.`);
}
});
return {
pass: feedback.length === 0,
feedback
};
return {
pass: feedback.length === 0,
feedback,
};
}
if (import.meta.main) {
@ -53,14 +60,24 @@ if (import.meta.main) {
const report = await generateAndLoadMutationReport(tempReport);
const gate = verifyQualityGate(report);
assert(gate.pass === false, "Expected quality gate to fail due to low mutation score");
assert(gate.feedback.length === 2, "Expected 2 pieces of critical feedback");
assert(
gate.pass === false,
"Expected quality gate to fail due to low mutation score",
);
assert(
gate.feedback.length === 2,
"Expected 2 pieces of critical feedback",
);
console.log("Adversary Agent Feedback generated from real File I/O mutation report:");
gate.feedback.forEach(f => console.log(` - ${f}`));
console.log(
"Adversary Agent Feedback generated from real File I/O mutation report:",
);
gate.feedback.forEach((f) => console.log(` - ${f}`));
await Deno.remove(tempReport);
console.log("✅ Mutation Testing PoC (Gen 2) successful: Enforced strict quality gate via structured report data.");
console.log(
"✅ Mutation Testing PoC (Gen 2) successful: Enforced strict quality gate via structured report data.",
);
} catch (err) {
console.error("❌ Mutation Testing PoC (Gen 2) failed:", err);
Deno.exit(1);

View File

@ -37,18 +37,20 @@ if (import.meta.main) {
let selectedAgent = null;
for (const [role, definition] of Object.entries(matrix)) {
const def = definition as any;
if (def.outputs.some((out: string) => out.includes("tests"))) {
selectedAgent = role;
break;
}
const def = definition as any;
if (def.outputs.some((out: string) => out.includes("tests"))) {
selectedAgent = role;
break;
}
}
assertEquals(selectedAgent, "Adversary");
console.log(`✅ Correctly routed to: ${selectedAgent} via real YAML parsed configuration.`);
console.log(
`✅ Correctly routed to: ${selectedAgent} via real YAML parsed configuration.`,
);
console.log("✅ Orchestration Matrix PoC (Gen 2) successful.");
} catch (err) {
console.error(`❌ Orchestration Matrix PoC (Gen 2) failed:`, err);
Deno.exit(1);
console.error(`❌ Orchestration Matrix PoC (Gen 2) failed:`, err);
Deno.exit(1);
}
}

View File

@ -8,7 +8,7 @@ import { assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
async function runGitCmd(
args: string[],
cwd?: string
cwd?: string,
): Promise<{ success: boolean; stdout: string; stderr: string }> {
const cmd = new Deno.Command("git", {
args,
@ -34,19 +34,28 @@ if (import.meta.main) {
await runGitCmd(["config", "user.email", "agent@forum.local"], tempRepoDir);
// Initial commit on main
await Deno.writeTextFile(`${tempRepoDir}/main.ts`, "console.log('main code');");
await Deno.writeTextFile(
`${tempRepoDir}/main.ts`,
"console.log('main code');",
);
await runGitCmd(["add", "main.ts"], tempRepoDir);
await runGitCmd(["commit", "-m", "Initial code commit"], tempRepoDir);
// Get default branch name since it might be main or master depending on git config
const branchRes = await runGitCmd(["branch", "--show-current"], tempRepoDir);
const branchRes = await runGitCmd(
["branch", "--show-current"],
tempRepoDir,
);
const mainBranch = branchRes.stdout || "master";
// Create an orphan branch for state
await runGitCmd(["checkout", "--orphan", "forum/meta-state"], tempRepoDir);
await runGitCmd(["rm", "-rf", "."], tempRepoDir);
const statePayload = JSON.stringify({ active_task: "task-001", status: "running" });
const statePayload = JSON.stringify({
active_task: "task-001",
status: "running",
});
await Deno.writeTextFile(`${tempRepoDir}/state.json`, statePayload);
await runGitCmd(["add", "state.json"], tempRepoDir);
@ -65,7 +74,9 @@ if (import.meta.main) {
await Deno.remove(tempRepoDir, { recursive: true });
console.log("✅ Orphan Branch (Gen 2) PoC successful: Verified absolute isolation of state vs code.");
console.log(
"✅ Orphan Branch (Gen 2) PoC successful: Verified absolute isolation of state vs code.",
);
} catch (err) {
console.error("❌ Orphan Branch (Gen 2) PoC failed:", err);
Deno.exit(1);

View File

@ -19,7 +19,9 @@ function canAgentExecute(
): boolean {
const rule = config[roleName];
if (!rule) {
throw new Error(`Role ${roleName} is not defined in the transitions matrix. Execution denied.`);
throw new Error(
`Role ${roleName} is not defined in the transitions matrix. Execution denied.`,
);
}
return rule.requires.every((req) => currentState.has(req));
}
@ -29,13 +31,18 @@ if (import.meta.main) {
try {
const tempFile = await Deno.makeTempFile({ suffix: ".json" });
await Deno.writeTextFile(tempFile, JSON.stringify({
"Coder": { "requires": ["Gatekeeper_Approval"] },
"Gatekeeper": { "requires": [] },
"Evaluator": { "requires": ["Coder_Completion"] }
}));
await Deno.writeTextFile(
tempFile,
JSON.stringify({
"Coder": { "requires": ["Gatekeeper_Approval"] },
"Gatekeeper": { "requires": [] },
"Evaluator": { "requires": ["Coder_Completion"] },
}),
);
const matrix: TransitionsConfig = JSON.parse(await Deno.readTextFile(tempFile));
const matrix: TransitionsConfig = JSON.parse(
await Deno.readTextFile(tempFile),
);
await Deno.remove(tempFile);
const currentState = new Set<string>();
@ -47,7 +54,9 @@ if (import.meta.main) {
assert(canAgentExecute("Coder", matrix, currentState) === true);
assert(canAgentExecute("Evaluator", matrix, currentState) === false);
console.log("✅ State Machine PoC (Gen 2) successful: Real File I/O BMC constraints enforced.");
console.log(
"✅ State Machine PoC (Gen 2) successful: Real File I/O BMC constraints enforced.",
);
} catch (err) {
console.error("❌ State Machine PoC (Gen 2) failed:", err);
Deno.exit(1);

View File

@ -8,17 +8,21 @@ import { assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
*/
async function readTelemetry(filePath: string) {
const data = await Deno.readTextFile(filePath);
return JSON.parse(data);
const data = await Deno.readTextFile(filePath);
return JSON.parse(data);
}
function analyzeFriction(telemetry: any): string[] {
const flags = [];
if (telemetry.metrics.idleHandoffDuration > 4) {
flags.push("High idle handoff duration detected. Workflow optimization required.");
flags.push(
"High idle handoff duration detected. Workflow optimization required.",
);
}
if (telemetry.metrics.prCommentToCodeRatio > 0.5) {
flags.push("High comment-to-code ratio. Potential ambiguity in requirements.");
flags.push(
"High comment-to-code ratio. Potential ambiguity in requirements.",
);
}
return flags;
}
@ -36,23 +40,29 @@ if (import.meta.main) {
const tempFriction = await Deno.makeTempFile({ suffix: ".json" });
const tempTrace = await Deno.makeTempFile({ suffix: ".json" });
await Deno.writeTextFile(tempFriction, JSON.stringify({
await Deno.writeTextFile(
tempFriction,
JSON.stringify({
sprint: "Sprint 42",
metrics: {
meanTimeToResolution: 14.5,
prCommentToCodeRatio: 0.8,
idleHandoffDuration: 5.2,
},
}));
}),
);
await Deno.writeTextFile(tempTrace, JSON.stringify({
await Deno.writeTextFile(
tempTrace,
JSON.stringify({
traceId: "5b8aa5a2d2c8646c14e4d97e6cdbc134",
spans: [
{ name: "db_query", duration_ms: 250 },
{ name: "serialize_json", duration_ms: 12 },
{ name: "http_request", duration_ms: 300 },
],
}));
}),
);
const frictionData = await readTelemetry(tempFriction);
const traceData = await readTelemetry(tempTrace);
@ -66,7 +76,9 @@ if (import.meta.main) {
await Deno.remove(tempFriction);
await Deno.remove(tempTrace);
console.log("✅ Telemetry Parsing PoC (Gen 2) successful: Parsed telemetry from files.");
console.log(
"✅ Telemetry Parsing PoC (Gen 2) successful: Parsed telemetry from files.",
);
} catch (err) {
console.error("❌ Telemetry Parsing PoC (Gen 2) failed:", err);
Deno.exit(1);

View File

@ -50,12 +50,24 @@ if (import.meta.main) {
`);
const insert = db.prepare(
"INSERT INTO documents (id, text, vector) VALUES (?, ?, ?)"
"INSERT INTO documents (id, text, vector) VALUES (?, ?, ?)",
);
insert.run("docs-1", "How to run the server", JSON.stringify([0.8, 0.1, 0.1, 0.0]));
insert.run("docs-2", "Database connection logic", JSON.stringify([0.1, 0.9, 0.2, 0.1]));
insert.run("telemetry-1", "Server latency spikes", JSON.stringify([0.2, 0.1, 0.9, 0.3]));
insert.run(
"docs-1",
"How to run the server",
JSON.stringify([0.8, 0.1, 0.1, 0.0]),
);
insert.run(
"docs-2",
"Database connection logic",
JSON.stringify([0.1, 0.9, 0.2, 0.1]),
);
insert.run(
"telemetry-1",
"Server latency spikes",
JSON.stringify([0.2, 0.1, 0.9, 0.3]),
);
insert.finalize();
// Query representing "I have a slow server issue"