Skip to content

Audit Log

Randy Northrup edited this page Nov 19, 2026 · 1 revision

Audit log

Everything posted, scheduled, edited or deleted on your behalf goes in one append-only file, playbook/audit/posts.jsonl, through playbook/audit.py. Lines are never rewritten: a later change is a new line that points at the entry. The canvas's History view and audit.py show merge them into each entry's current state and timeline.

The log is what makes the agent's work checkable: what went out, where, with what words, whether it was seen live, and why anything was taken down. It also feeds the QC filters that count (caps, spacing, duplicates, "already replied") and the run report.

Entries

Each send is one line with "kind": "item":

Field What it is
id <date>-<platform>-<8 hex>, for example 2026-11-18-x-7570773f. Printed by add.
logged_at When the line was written
at When it went out: now, or --at 2026-11-08T14:02 (a date alone means that day)
at_precision exact when at has a time, day when it is a date only. Pacing only counts exact times.
platform, account, action Where, as whom, and what (post, reply, comment, article, video, quote, schedule, edit, delete...)
project The app it was about (--project)
url The link to what was posted
target What it answered or where it was posted
title For articles and videos
text The full words, exactly as posted
text_source, source, notes Free text: where the words came from, where the entry was logged from, anything else
media Files attached (--media, repeatable)
status See below
scheduled_for For a scheduled post
verified How it was checked live
reason Why it was deleted or removed
place Subreddit, group, channel (--place)
promo Whether it promoted the owner's app (--promo / --no-promo)
qc, qc_warn The passing QC receipt id, and any warning filter ids
qc_override Why it was logged without a passing receipt
pace_flag Set when it went out sooner after the previous send than the pacing rules allow

A later change is a line with "kind": "update" and "of": "<id>", carrying any of status, reason, verified, url, note, text and scheduled_for, plus its own time.

Never put secrets in the log. It holds the full text of everything posted.

Statuses

live, scheduled, pending, skipped, failed, deleted, removed, unknown.

  • live and pending count as sent for pacing; QC also counts scheduled entries, at their scheduled time.
  • deleted (you took it down) and removed (the platform or a moderator did) always need a reason.

Logging a send

python playbook/audit.py add --platform X --account @acmenotes_demo --action reply --project acme-notes --url https://x.com/acmenotes_demo/status/9001 --target https://x.com/a_reader/status/3001 --text-file reply.txt --no-promo

add needs --platform, --action, and the words (--text or --text-file), or at least --title or --url. The status defaults to live. It refuses, with exit 1:

Refusal Why Way out
"already logged as ..." The same platform, account and action already has this link, or this text within 24 hours --force if it really is another one
"--account ... isn't in the accounts registry for X" The handle isn't an account on that platform in store/accounts Use the handle pb.py accounts X prints, or --force
"--account ... is marked retired in the accounts registry for X: nothing goes out from it" The account's status is retired or skip Use another account, change its status if it is back in use, or --force for a send that really went out
"no QC receipt for this text..." / "QC blocked this text" See QC gate Check the exact words, or --override "why"
"a reason is required to log a deletion or removal" --action delete, or status deleted or removed --reason "why"

Two things are recorded rather than refused:

  • Pace flag. If the send came sooner after the previous one of its kind than the rules allow (replies 30 seconds, posts 10 minutes, Facebook group posts by state/groups.tsv), add stores a pace_flag and says so on stderr. Logging a batch afterwards? Pass --at with each real send time.
  • No open run. If no run checklist is open, add prints a note suggesting run.py start.

The platform is written in the log's own spelling, so reddit and Reddit count as one platform.

Verifying, updating, deleting

There is no separate verify command: verifying is an update.

python playbook/audit.py update 2026-11-18-x-7570773f --status live --verified "opened the reply link; the text matches"
python playbook/audit.py update 2026-11-18-x-7570773f --note "they replied with thanks"
python playbook/audit.py update 2026-11-18-x-7570773f --status deleted --reason "the owner asked to take it down: wrong version number"
python playbook/audit.py update 2026-11-18-x-7570773f --status removed --reason "removed by the subreddit's moderators"

update needs at least one field. Marking an entry deleted or removed without --reason is refused. Say "posted", "live" or "deleted" only after checking the live page that moment (part part-verify-live).

Before a send: gap

python playbook/audit.py gap --platform X --account @acmenotes_demo --action reply

Prints READY (...) and exits 0, or WAIT 25 s more: ... and exits 1. It applies the same spacing rules add flags afterwards: replies 30 seconds apart, posts 10 minutes, Facebook group posts by the group's line in state/groups.tsv (pass --place <group slug>). It also refuses (exit 1) an account the registry doesn't know, or one marked retired or skip.

Reading the log

Command Shows
audit.py today [--platform X] Counts for your local day per platform, account and action, then today's pace flags
audit.py recent --platform X [--account A] [--place P] [-n 4] The last few things posted there, newest first: when, action, project, promo or not, status, where, first words
audit.py list [--platform X] [--project P] [--status S] [--action A] [--since 2026-11-01] [-n 50] Matching entries, oldest of the last N first, and the total count
audit.py show <id> One entry in full with every update. The end of an id is enough (show 7570773f).
audit.py search <text> Every entry whose stored fields contain the text
audit.py stats Counts per platform, project, action and status, and how many deletions have no reason recorded
$ python playbook/audit.py today
2026-11-18 (local day)
X               @acmenotes_demo                1  reply 1
1 item(s) today

The agent runs audit.py today at the start of a run against the caps in flow pacing, and audit.py recent before writing an original, so it doesn't repeat itself.

Importing

python playbook/audit.py import old-posts.jsonl

Each line is a JSON object with any of the entry fields above (at, platform, account, action, project, url, target, title, text, text_source, media, status, scheduled_for, verified, source, notes, reason, place, promo). Every line is validated first; if any line is wrong, nothing is imported and each problem is listed. Entries whose id is already in the log are skipped. Imported entries are marked "imported": true. Import doesn't run the QC gate or the registry check.

Rules of the log

  • Append only. Don't edit or delete lines; change an entry with update. (The one sensible exception is clearing the demo's entries before your first real one; see Make it yours.)
  • Every deletion and removal has a reason.
  • Log right after each send, before the next one, with the exact words.
  • Writes take a lock, so several agents can log at once without losing a line. If another process holds it for more than 20 seconds, the command fails with "the audit log is busy"; run it again.

Clone this wiki locally