Buffaly Logo Buffaly
Companion agent

Online Action Critic

The Online Action Critic is a hidden, independent companion that reviews exactly one completed source turn at a time and learns reusable source-local actions. It does not learn ontology objects, and it does not invoke the Online Memory Critic. The two critics are separate runtimes with separate artifacts.

What it is

Profile online-action-critic creates the deterministic child {source}-online-action-critic. Only that child subscribes to turn.completed. The handler is ToDispatchOnlineActionCriticEvent.

Each instruction includes SourceSessionKey, TurnKey, CorrelationId, a bounded turn digest, and tool-evidence references. Arguments and results are not dumped into the prompt. The critic fetches exact evidence by ToolCallId and ResultMessageKey when a preview is insufficient.

Decision gate

A source-local action is created or refined only when all of these are true:

  1. The turn reveals a reusable subgoal likely to recur in human language.
  2. A dedicated action would materially improve correctness, determinism, orchestration, or effort.
  3. Source action search finds no sufficient existing action, or there is an evidence-backed improvement to an action already owned by this source's SessionActions.pts.
  4. The behavior is implementable now in trusted ProtoScript using loaded typed services or actions.

The critic does not create actions for one-off work, routing/description problems, transient provider failures, malformed arguments, expected guardrail rejection, or product defects. A successful generic PowerShell call is not proof that a dedicated action already exists. A substantial recurring script is strong evidence that one should.

Implementation rules

Learned actions may be deterministic ProtoScript, prompt-backed, or hybrid. Prefer deterministic ProtoScript when it is simpler or more reliable. V1 does not generate unrestricted C#.

  • Write exactly one complete executable prototype per source write.
  • Use SemanticProgram.ScopedInfinitivePhrase(...) so the phrase stays Local to the source session. Never use global InfinitivePhrase on a learned action.
  • Inherit from an existing base such as OpsAction. Call loaded actions through exact .Execute(...) signatures.
  • Search source actions with at least two clean human-language phrasings before creating.
  • Same-name updates are allowed only for definitions already owned by this source's SessionActions.pts. Permanent, package, core, and external actions are never overwritten.

A source-local action may encapsulate a stable parameterized script by calling the managed PowerShell action. Trivial pass-through wrappers and genuinely one-off scripts are rejected.

Failures vs bugs

A failed tool call is not automatically a bug. The critic first distinguishes misuse, malformed arguments, wrong routing, expected rejection, transient infrastructure failure, missing orchestration, and actual implementation failure.

If exact evidence supports a likely existing-action defect, it records SuspectedProductBug and emits one source-visible notification. It does not hide a suspected defect with a local workaround, and it does not notify for non-bug classifications.

Ledger and idempotency

artifacts/online-action-critic/ActionLedger.md is the only provenance ledger. Every turn ends with ToRecordOnlineActionCriticTurnReview, even for NoChange, NonBugFailure, or SuspectedBug. Reprocessing the same turn must not blindly duplicate a definition, revision, review, or bug.

After a successful create or refinement, the critic searches the source phrase, reads the stored definition, invokes the action when safe, and records a revision with rationale, source turn, validation, and limits.

Lifecycle

Manual attach reconciles the profile-declared critic, enables its runtime, persists the catalog-validated provider/model selection, then queues the selected-turn instruction. That order matters: an existing OpenAI-backed companion must not keep running after the companion is switched to Ollama.

Replay clears only turn checkpoints. Start fresh requires explicit confirmation, archives and unloads only the deterministic critic child, clears only its timeline rows, restores it, and resets the ledger so old judgments cannot leak into a new run. Source actions stay source-local until a separate promotion review.

Default model

The current default is Ollama GLM 5.2 medium, selected from a controlled 60-turn comparison plus a larger GLM scale run. GPT-5.6 Sol medium is the OpenAI control/fallback. No model produced a set suitable for automatic global promotion without curation. Learned actions stay source-local until duplicate, semantic-scope, implementation, risk, and promotion review is complete.

Next