@molecule/api-agent-transcript-aider
Provider bond · agent-transcript · API (Node) · v1.0.1 · Apache-2.0
Reads Aider's chat history file (.aider.chat.history.md) into a normalized agent session
npm install @molecule/api-agent-transcript-aidernpm · Source on GitHub · Implements @molecule/api-agent-transcript
How it works
@molecule/api-agent-transcript-aider is a provider bond on the API (Node) side: it implements the agent-transcript core interface (@molecule/api-agent-transcript) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { readFileSync } from 'node:fs'
import { readTranscript, setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-aider'
setProvider(provider)
const file = '.aider.chat.history.md'
const session = readTranscript({ text: readFileSync(file, 'utf8'), fileName: file })
console.log(session.model, session.turns.length)Works with: @molecule/api-agent-transcript
Reference
Aider transcript reader for @molecule/api-agent-transcript.
Reads the chat history Aider keeps in every project it works in,
.aider.chat.history.md, into a normalized AgentSession: what you typed,
what the model replied, the model Aider announced, and the files its edits
wrote.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { readFileSync } from 'node:fs'
import { readTranscript, setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-aider'
setProvider(provider)
const file = '.aider.chat.history.md'
const session = readTranscript({ text: readFileSync(file, 'utf8'), fileName: file })
console.log(session.model, session.turns.length)
Type
provider
Installation
npm install @molecule/api-agent-transcript-aider @molecule/api-agent-transcript
API
Functions
looksLikeAiderHistory(text)
Whether a text is an Aider chat history file.
function looksLikeAiderHistory(text: string): boolean
text— The file's text.
Returns: True when it has a session start line.
editBlocksOf(text)
The SEARCH/REPLACE blocks in a reply, each with the file name written on the line before its fence (or as the fence's first line).
function editBlocksOf(text: string): EditBlock[]
text— The reply.
Returns: The blocks.
readAiderHistory(text)
Read every session in an Aider chat history file into one session, in
file order. startedAt is the first session's start, as Aider wrote it
(local time, no zone).
function readAiderHistory(text: string): AgentSession
text— The history file's text.
Returns: The normalized session.
Constants
provider
Reads Aider's .aider.chat.history.md.
const provider: AgentTranscriptReader
Core Interface
Implements @molecule/api-agent-transcript interface.
Bond Wiring
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-agent-transcript'
import { provider } from '@molecule/api-agent-transcript-aider'
export function setupAgentTranscriptAider(): void {
setProvider(provider)
}
Injection Notes
Requirements
Peer dependencies:
@molecule/api-agent-transcript^1.0.0
Runtime Dependencies
-
@molecule/api-agent-transcript -
One file holds every session run in that directory, each opened by a
# aider chat started at …line.read()returns them all as one session in file order;startedAtis the first one's start, in the local time Aider wrote (no zone). -
Slash commands you typed (
/add,/run…) are not turns; neither is Aider's own output (the>lines: announcements, token counts, commits). -
The model comes from Aider's announcement (
Model:/Main model:), and applies to every reply after it until the next announcement. -
Files: every
Applied edit to <path>Aider reports, with the text from the reply's SEARCH/REPLACE block for that path (an empty SEARCH is a new file), or the fenced block under the path in thewholeedit format. When neither is found the write is listed withcomplete: false. -
Aider's own lines end in two spaces; that is what separates them from a
>quote or####heading inside a reply. A history file edited by hand that lost those spaces reads the edited lines as part of the reply. -
Format verified 2026-09-29 against the Aider source (
aider/io.py).