Skip to content

feat(utp): implement Universal Transpilation Protocol as callable-agent pipeline#39

Open
rfreel wants to merge 4 commits intomainfrom
codex/scaffold-typescript-rlm-repository
Open

feat(utp): implement Universal Transpilation Protocol as callable-agent pipeline#39
rfreel wants to merge 4 commits intomainfrom
codex/scaffold-typescript-rlm-repository

Conversation

@rfreel
Copy link
Owner

@rfreel rfreel commented Feb 12, 2026

Motivation

  • Replace the prior ad-hoc demo flow with a deterministic, inspectable four-phase pipeline that emits a fixed five-section contract for auditing and downstream automation.
  • Provide a small, typed callable-agent architecture so each UTP phase (deconstruction, abstract specification, native creation, and audit) can be invoked, tested, and evolved independently.
  • Ensure the repository loop bookkeeping records one completed PRD item for traceability and CI/back-pressure compliance.

Description

  • Implemented a callable-agent UTP scaffold under src/utp/ with phases Structural_Analyst, Abstract_Specifier, Domain_Specialist, Variance_Detector, a CallableAgent type, and UtpOrchestrator that composes them and returns the five required sections.
  • Added typed contracts and runtime glue including src/utp/types.ts, an entrypoint that runs the orchestrator (src/main.ts), and README documentation describing the contract and run commands.
  • Added supporting runtime modules and types for the original runtime scaffold (environment validation, result type, core agent primitives, memory engine, storage, and telemetry) to make the pipeline integrated and observable.
  • Updated loop bookkeeping (prd.json, progress.txt, loop/log.txt) to mark DECIDE-003 complete and committed the changes.

Testing

  • Ran repository loop checks with bash scripts/ralph/loop.sh, which reported success (passed).
  • Ran the radius/back-pressure check bash scripts/ralph/radius.sh loop/log.txt 50 && bash scripts/ralph/loop.sh, which reported success (passed).
  • Pre-commit checks ran as part of the commit and passed (several [OK] pre-commit passed entries in loop/log.txt).
  • Attempted pnpm install / pnpm dev to run TypeScript build and runtime, but pnpm install could not be completed due to an environment network/proxy restriction (network failure), so runtime execution and full typecheck were not completed in this environment.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db67a9f11d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +51 to +53
const result = await this.options.llm.generate([
{ role: 'system', content: injectedPrompt },
{ role: 'user', content: input },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include per-agent instructions in the system prompt

BaseAgentOptions.instructions is never used when building the LLM prompt, so any agent-specific behavior/config passed at construction time is silently ignored. In run, the system message only contains injectMemoryContext(), which means all agents effectively run with the same generic prompt and can miss required constraints/tool policies; this will surface whenever two agents are expected to behave differently via their instructions.

Useful? React with 👍 / 👎.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment "https://github.com/codex review".

Comment on lines +37 to +41
return;
}

const sourceIds = snapshot.shortTerm.map((message) => message.id);
await this.memory.observe(sourceIds);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid re-observing unchanged context on every poll

After the short-term token budget first crosses OBSERVER_TOKEN_THRESHOLD, every subsequent poll triggers memory.observe again with the same message window because there is no "last observed" cursor or dedup check. In an idle conversation that remains above threshold, this causes repeated LLM calls every OBSERVER_POLL_MS (default 2s), creating duplicate observations and unnecessary cost/load.

Useful? React with 👍 / 👎.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment "https://github.com/codex review".

Comment on lines +40 to +42
const output = await context.with(trace.setSpan(context.active(), span), () => fn(span));
span.setStatus({ code: SpanStatusCode.OK });
return output;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set span status from Result failures, not only thrown errors

withSpan unconditionally marks spans as OK whenever fn resolves, but many call sites resolve to Result.err rather than throwing (e.g., LLM/tool wrappers). That means failed operations are exported as successful spans, which undermines telemetry-based debugging/alerts in exactly the scenarios where the operation failed without an exception.

Useful? React with 👍 / 👎.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment "https://github.com/codex review".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant