Skip to content

#1047 Action Plan — Agent Builder Integration #1053

@ootakazuhiko

Description

@ootakazuhiko

Repo: itdojp/ae-framework • Issue: #1047


🇬🇧 Executive Summary

Concrete, small-batch PR plan to advance #1047 now: define internal Flow Schema (Intent→Operate), extend the Envelope, add CI schema validation, and bootstrap an Agent Builder adapter skeleton with a minimal end-to-end PoC.

🇯🇵 概要

#1047 を今すぐ前進させる小粒PR計画。内部フロースキーマ(Intent→Operate)定義、Envelope拡張、CIでのスキーマ検証、Agent Builder互換アダプタの雛形、最小E2E PoCまで一気通貫で進めます。


1) Milestone & Timeline / マイルストーン

  • M1 (Day 0–2): Spec & CI

    • Flow Schema v0.1(JSON)
    • Envelope v1.0 schema + Ajv CI
    • Vitest snapshot baseline
  • M2 (Day 3–5): Adapter Skeleton & PoC

    • agent-builder-adapter skeleton(TS)
    • Minimal PoC: Intent→Formal→Code→Verify(dummy nodes)
  • M3 (Day 6–10): Trace/Docs

    • Trace correlation (runId/commit/branch)
    • Docs + examples + dashboard wiring (stub)

2) Workstreams & PRs / 作業ストリームとPR

PR-1: Flow Schema v0.1 + Envelope v1.0

Scope

  • Add: schema/flow.schema.json (Intent→Operate)
  • Add: schema/envelope.schema.json (unified)
  • Add: scripts/ci/validate-json.mjs (Ajv)
  • CI: validate:schemas job + Job Summary output
  • Docs: docs/flow/README.md

Acceptance

  • Ajv validates sample fixtures
  • schemaVersion (semver) embedded in all JSONs
  • Job Summary shows PASS/FAIL with paths

Example files

  • fixtures/flow/sample.flow.json
  • fixtures/envelope/sample.envelope.json

PR-2: Verify Lite → Envelope adapter

Scope

  • Implement converter: packages/envelope/src/from-verify-lite.ts
  • Ensure stable path: artifacts/verify-lite/verify-lite-run-summary.json
  • Vitest snapshot: __snapshots__/from-verify-lite.test.snap

Acceptance

  • Conversion produces envelope v1.0
  • Snapshot green across 3 input variants (small/mid/edge)

PR-3: Agent Builder Adapter (skeleton)

Scope

  • New pkg: packages/agent-builder-adapter

    • parseFlow.ts (AB flow JSON → internal graph)
    • types.ts (Node, Edge, Param, IO schemas)
    • execSimulator.ts (deterministic mock runner)
  • CLI: ae flow run -f fixtures/flow/sample.flow.json

Acceptance

  • Parses sample AB-like JSON (stable contract)
  • Simulated run produces deterministic trace + envelope

PR-4: Minimal E2E PoC

Scope

  • Nodes: intent2formal, tests2code(minimal), code2verify(minimal)
  • Wire with adapter simulator; output envelope + junit
  • Docs: docs/agent-builder/poc.md (how-to)

Acceptance

  • npm run demo:ab-poc runs end-to-end
  • Job Summary lists node-by-node status

3) File Structure Additions / 追加ファイル構成

/schema
  ├─ flow.schema.json
  └─ envelope.schema.json
/fixtures
  ├─ flow/sample.flow.json
  └─ envelope/sample.envelope.json
/packages
  ├─ envelope/src/from-verify-lite.ts
  └─ agent-builder-adapter/
      ├─ src/parseFlow.ts
      ├─ src/execSimulator.ts
      └─ src/types.ts
/scripts/ci/validate-json.mjs
/docs
  ├─ flow/README.md
  └─ agent-builder/poc.md

4) Schemas (Drafts) / スキーマ(ドラフト)

4.1 Envelope v1.0 (excerpt)

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ae-framework/schema/envelope.schema.json",
  "title": "ae-envelope",
  "type": "object",
  "properties": {
    "schemaVersion": {"type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$"},
    "source": {"type": "string"},
    "generatedAt": {"type": "string", "format": "date-time"},
    "traceCorrelation": {
      "type": "object",
      "properties": {
        "runId": {"type": "string"},
        "commit": {"type": "string"},
        "branch": {"type": "string"}
      },
      "required": ["runId"]
    },
    "summary": {"type": "object"},
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {"type": "string"},
          "path": {"type": "string"}
        },
        "required": ["type", "path"]
      }
    }
  },
  "required": ["schemaVersion", "source", "generatedAt", "traceCorrelation", "summary"]
}

4.2 Flow Schema v0.1 (excerpt)

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ae-framework/schema/flow.schema.json",
  "title": "ae-flow",
  "type": "object",
  "properties": {
    "schemaVersion": {"type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$"},
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {"type": "string"},
          "kind": {"type": "string", "enum": [
            "intent2formal","formal2tests","tests2code","code2verify","verify2operate"
          ]},
          "params": {"type": "object"},
          "input": {"type": "array"},
          "output": {"type": "array"}
        },
        "required": ["id","kind"]
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {"type": "string"},
          "to": {"type": "string"}
        },
        "required": ["from","to"]
      }
    },
    "metadata": {"type": "object"}
  },
  "required": ["schemaVersion","nodes","edges"]
}

5) CI Snippets / CI 追加スニペット

scripts/ci/validate-json.mjs (Ajv runner)

import { readFileSync } from 'node:fs';
import Ajv from 'ajv';
import addFormats from 'ajv-formats';

const ajv = new Ajv({ allErrors: true, strict: false });
addFormats(ajv);

const schema = JSON.parse(readFileSync('schema/envelope.schema.json','utf8'));
const data = JSON.parse(readFileSync('fixtures/envelope/sample.envelope.json','utf8'));

const validate = ajv.compile(schema);
const ok = validate(data);
if (!ok) {
  console.error(JSON.stringify(validate.errors, null, 2));
  process.exit(1);
}
console.log('Envelope schema validation: OK');

GitHub Actions step (excerpt)

- name: Validate Envelope schema
  run: node scripts/ci/validate-json.mjs

6) Vitest Snapshot Example / スナップショット例

import { describe, it, expect } from 'vitest';
import { fromVerifyLite } from '../src/from-verify-lite';
import sample from '../../fixtures/verify-lite/sample.json';

describe('fromVerifyLite', () => {
  it('produces stable envelope', () => {
    const env = fromVerifyLite(sample);
    // scrub volatile fields
    env.generatedAt = '1970-01-01T00:00:00Z';
    expect(env).toMatchSnapshot();
  });
});

7) Sample Flow / Envelope Fixtures / サンプル

fixtures/flow/sample.flow.json (mini)

{
  "schemaVersion": "0.1.0",
  "nodes": [
    {"id":"n1","kind":"intent2formal","params":{"lang":"en"}},
    {"id":"n2","kind":"tests2code","params":{"language":"ts"}},
    {"id":"n3","kind":"code2verify","params":{"runner":"vitest"}}
  ],
  "edges": [
    {"from":"n1","to":"n2"},
    {"from":"n2","to":"n3"}
  ],
  "metadata": {"name":"mini-poc"}
}

fixtures/envelope/sample.envelope.json (mini)

{
  "schemaVersion": "1.0.0",
  "source": "verify-lite",
  "generatedAt": "2025-10-06T00:00:00Z",
  "traceCorrelation": {"runId": "demo-run", "commit": "HEAD", "branch": "feat/ab-poc"},
  "summary": {"cases": 7, "passed": 7},
  "artifacts": [{"type":"json","path":"artifacts/verify-lite/verify-lite-run-summary.json"}]
}

8) Commands / コマンド例

# Run schema validation
npm run ci:validate:envelope

# Simulate AB flow execution (local)
npm run flow:run -- -f fixtures/flow/sample.flow.json

# Demo E2E
npm run demo:ab-poc

9) Owner & Labels / 担当とラベル

  • Owners: @ootakazuhiko (P), @contrib-A (S)
  • Labels: feature, architecture, ai-agent, good-first-pr (PR-1 only)

10) Risks & Checks / リスクとチェック

  • Schema drift → snapshot + semver
  • Adapter instability → versioned mapping table
  • Non-determinism → scrub timestamps/ids in tests

11) Definition of Done / 完了基準

  • CI validates Envelope/Flow fixtures;
  • Adapter parses & simulates sample flow;
  • PoC runs end-to-end and produces an Envelope;
  • Docs published under /docs/agent-builder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions