Interface CoTHistory


public interface CoTHistory
The history mechanism automatically maintains a list of the last N actions taking by an AI as part of executing a CoTProcess, to help the AI maintain context when it needs to execute a series of CoTTasks as part of an overall, logical task.

This is needed to support the more predictable "AI Workflow" execution model for enterprise AI workflows.

What is recorded

History is tracked automatically for: (a) transitions (the model emitted {goTo,intent,stepAfter}), and (b) successful non?transition results that were validated and applied to state (for example via CoTTask.stateUpdates).

History storage

The primary list is kept on the process as history. For ease of serialization and prompt access, a bounded mirror is also maintained at process.state.history. Both lists are append?only during a run.

Including history in prompts

History is typically referenced from standard prompt template via the "${promptPart('history')}", which includes the CoTProcess.historyPrimer and history data.

Manual entries

Add entries programmatically via CoTProcess.addHistory(). This appends to the process history and mirrors to state.history within configured limits.
  process.addHistory({
    taskID: task.ID,
    summary: "Added field 'orderDate'",
    ts: Date.now()
  });
  

How much history reaches the prompt

History is rendered in two zones. The most recent CoTProcess.historyDetailItems entries appear in full, with their intent and stepAfter. Every earlier entry appears as a single action | result line, capped at CoTProcess.historyResultMaxChars characters. Nothing is omitted: a process uses this log to know what it has already done, so an entry that disappeared would be work the process would repeat.

Set CoTProcess.historyDetailItems to trade prompt size against detail, and CoTProcess.noHistory to leave history out of a prompt altogether.

Maximum history entries

CoTProcess.historyMaxItems is a retention ceiling on the in-memory list - a guard against a runaway process, not a way to bound the prompt. The mirrored state.history maximum is CoTProcess.stateHistoryMaxItems, and defaults to the in-memory ceiling if unset.

Truncation in Partial Prompts

When generating partial prompts, history can be truncated via PartialPromptConfig.truncateHistory to include only the N most recent entries. This is useful when debugging recent actions without including the full history.