Ag Ledger logo

Ag Ledger

Community
kevinslin
ag-ledger

Record, sync, and query local agent activity ledger entries.

Overview

Publisherkevinslin
Repositoryagstack
Skill nameag-ledger
Stars
26
Forks
1
Bundled files
5
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by kevinslin on GitHub. Read the source before you install it.

Installation

Install the Ag Ledger AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/kevinslin/agstack/tree/main/active/ag-ledger
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kevinslin/agstack.git /tmp/agstack
mkdir -p .claude/skills
cp -r /tmp/agstack/active/ag-ledger .claude/skills/ag-ledger
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ag Ledger in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ag Ledger on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ag Ledger is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

AG Ledger

Overview

Track agent activity as append-only JSON lines and query prior entries without editing historical records. Prefer the bundled sync workflow for Codex conversations so activity tracking happens through a recurring automation rather than per-conversation AGENTS injection.

Recommended Workflow

  1. Run a recurring automation with execution_environment = "local" that executes ag-ledger sync from the skill directory. Sync does not mutate the repository, so do not create a disposable Git worktree for each run.
  2. Let sync scan recent Codex rollout transcripts, derive deterministic session start, notable change, and session end entries, and persist state so unchanged files are skipped on later runs.
  3. Treat the returned closeout_state as terminal for that scheduled run:
    • settled: no missing entries and no failures.
    • live_frontier: entries were appended without failures. Stop and let the next scheduled run verify the moving frontier; do not loop until zero.
    • blocked: at least one file or state write failed. The second consecutive identical blocker fingerprint sets stable_blocked=true.
  4. If a sandboxed run is blocked only by the shared-ledger write barrier, request one write-capable retry. Stop after that retry and report its state; do not create a multi-rerun convergence loop.
  5. Use manual append or append-current only for explicit ad hoc entries or non-Codex workflows.

Recommended automation cadence:

  • hourly

Recommended automation command:

bash
./scripts/ag-ledger sync

CLI Commands

Run from the skill directory or place scripts/ on PATH.

bash
# sync recent Codex conversations into the ledger
ag-ledger sync
ag-ledger sync --lookback-minutes 180
ag-ledger sync --session-root ~/.codex/sessions
ag-ledger sync --state-file ~/.llm/ag-ledger/state/sync-state.json

# inspect the last persisted closeout without scanning transcripts
ag-ledger status
ag-ledger status --state-file ~/.llm/ag-ledger/state/sync-state.json

# append entry (manual session id)
ag-ledger append <session-id> "<message>"
ag-ledger apppend <session-id> "<message>"
ag-ledger append <session-id> --invoked-skill ag-learn --mode review --parent-session-id <parent-session-id> "<message>"

# append entry using current Codex thread (CODEX_THREAD_ID)
ag-ledger append-current "<message>"
ag-ledger appendc "<message>"
ag-ledger append-current --invoked-skill ag-learn --mode review "<message>"

# print current Codex session id (CODEX_THREAD_ID)
ag-ledger session-id

# filter entries
ag-ledger filter --session <session-id>
ag-ledger filter --workspace <workspace-abs-path>
ag-ledger filter --invoked-skill ag-learn
ag-ledger filter --mode review
ag-ledger filter --parent-session-id <parent-session-id>
ag-ledger filter --from YYYY-MM-DD
ag-ledger filter --from "YYYY-MM-DD HH:MM"
ag-ledger filter --from "YYYY-MM-DD HH:MM" --to "YYYY-MM-DD HH:MM"

# legacy compatibility command
ag-ledger init

ag-ledger init is deprecated. It no longer edits AGENTS.md; it prints a migration note that points callers to the automation-first sync workflow.

Data Layout

  • Root directory: $META_LEDGER_ROOT (default ~/.llm/ag-ledger)
  • Ledger data directory: $META_LEDGER_ROOT/data
  • Sync state file: $META_LEDGER_ROOT/state/sync-state.json
  • Daily file: ledger-YYYY-MM-DD.md
  • Format: append-only JSONL, local timestamp at minute precision

The sync state includes a closeout record:

json
{
  "closeout": {
    "state": "blocked",
    "reason": "files_failed",
    "stable": true,
    "blocker_fingerprint": "sha256",
    "blocker_occurrences": 2
  }
}

Both sync and status print the flattened fields closeout_state, closeout_reason, and stable_blocked. Blocked output also includes blocker_fingerprint and blocker_occurrences.

Manual entries use the existing shape:

json
{"time":"YYYY-MM-DD HH:MM","workspace":"/abs/path","session":"session-id","msg":"task summary"}

Sync-derived entries add source metadata so rows can be traced back to a rollout file:

json
{
  "time":"YYYY-MM-DD HH:MM",
  "workspace":"/abs/path",
  "session":"session-id",
  "msg":"session start: inspect current ag-ledger behavior",
  "entry_kind":"session_start",
  "source_key":"/abs/rollout.jsonl:42:session_start",
  "source_path":"/abs/rollout.jsonl",
  "source_line":42,
  "source_phase":"commentary",
  "source_role":"assistant",
  "source_turn_index":1
}

Optional structured fields supported on manual entries and sync-derived rows:

  • invoked_skill: canonical skill name when the entry is part of a specific skill workflow
  • invoked_skills: ordered list of skill names when a transcript turn names more than one
  • invocation_trigger: heuristic classification such as explicit, implicit, required-by-repo, or catalog-only
  • mode: execution mode such as review, code, or apply
  • parent_session_id: parent/fork/root session id for subagent lineage

sync fills invoked_skill and invoked_skills when a transcript message explicitly names known skills using backticks, $skill, a source path, JSON metadata, or plain using / running language. It also sets invocation_trigger so review tooling can filter structured data instead of parsing prose. Sync and status summaries identify themselves with invoked_skill=ag-ledger, mode=sync|status, and invocation_source=ag-ledger-cli.

Notes

  • sync defaults to a 24-hour lookback window.
  • sync reads rollout transcripts from $CODEX_HOME/sessions when CODEX_HOME is set, otherwise ~/.codex/sessions.
  • sync skips unchanged rollout files by file fingerprint and re-checks changed files without duplicating existing ledger rows.
  • Sync uses transcript event timestamps, not sync execution time, when choosing the target daily ledger file.
  • A successful append run is live_frontier, not settled. Settlement requires a later run with zero appended entries and zero failures.
  • Stable blocker matching uses normalized failure kind, operation, and storage scope so changing rollout filenames do not hide a repeated write barrier.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ag Ledger AI skill do?

Record, sync, and query local agent activity ledger entries.

Why use Ag Ledger on TypingMind?

Because you install it once and use it with any model. Ag Ledger is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ag Ledger in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/kevinslin/agstack/tree/main/active/ag-ledger. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ag Ledger?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ag Ledger?

As many as you like. As long as a model supports skills, you can use Ag Ledger with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ag Ledger AI skill free?

It is published on GitHub by kevinslin. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇