Tyler Gillispie 0a1c9305be
Add assessment and Proof-of-Concepts for agent-forum-v4 (#62)
- Analyzed agent-forum-v4 blueprint and created `ASSESSMENT.md`.
- Implemented `git_storage_poc.ts` to prove we can read/write Git Notes invisibly.
- Implemented `dag_engine_poc.ts` to prove we can parse YAML DAGs and calculate critical path.
- Implemented `code_intelligence_poc.ts` to prove we can parse AST-like JSON from raw source.
- Stored all work in an isolated `scratch/agent-forum-experiments/` directory to strictly prevent interference with the core Auth-Yes repository logic.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
2026-08-28 17:27:52 -07:00

72 lines
2.2 KiB
TypeScript

import { assert, assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
/**
* Proof of Concept: Git Storage (Notes & Orphan Branches)
*
* This module demonstrates how we can use Deno's `Deno.Command` API to interact
* with Git Notes and Orphan Branches to store agent state and metadata without
* polluting the main working tree.
*/
async function runGitCmd(args: string[]): Promise<string> {
const cmd = new Deno.Command("git", {
args,
stdout: "piped",
stderr: "piped",
});
const output = await cmd.output();
const stdout = new TextDecoder().decode(output.stdout).trim();
const stderr = new TextDecoder().decode(output.stderr).trim();
if (!output.success) {
throw new Error(`Git command failed: git ${args.join(" ")}\n${stderr}`);
}
return stdout;
}
export async function addGitNote(ref: string, message: string, targetRef: string = "HEAD") {
// First, check if a note already exists to avoid overwriting blindly
// For this PoC, we will append or overwrite
await runGitCmd(["notes", "--ref", ref, "add", "-f", "-m", message, targetRef]);
}
export async function readGitNote(ref: string, targetRef: string = "HEAD"): Promise<string> {
try {
return await runGitCmd(["notes", "--ref", ref, "show", targetRef]);
} catch (error: any) {
if (error.message.includes("No note found")) {
return "";
}
throw error;
}
}
// In a real scenario, tests would be separated. For this PoC, we will run the tests here.
if (import.meta.main) {
console.log("Running Git Storage PoC tests...");
// 1. Test Git Notes
const customRef = "forum/test-reasoning";
const testMessage = JSON.stringify({
agent: "poc-agent",
risk: "low",
thought: "This is a hidden thought stored in a git note."
});
try {
console.log(`Adding note to current HEAD under ref ${customRef}...`);
await addGitNote(customRef, testMessage);
console.log(`Reading note back...`);
const readMessage = await readGitNote(customRef);
assertEquals(readMessage, testMessage);
console.log("✅ Git Notes PoC successful: Read/Write worked as expected.");
// Clean up
await runGitCmd(["notes", "--ref", customRef, "remove", "HEAD"]);
} catch (err) {
console.error("❌ Git Notes PoC failed:", err);
}
}