how i check every scheduled run before it spends a cent:
1. a --check command runs first: key file present, API reachable, key accepted, model slug in the live list. prints CHECK OK or CHECK FAILED with the reason
2. --dry-run builds the full prompt and prints its token count and a cost estimate from live pricing, without calling the model
3. if the check fails, the job runs one pinned fallback and reports why. it never tries another route to the network
4. every real run logs tokens in, tokens out, cost and model name for a weekly report
5. the key is read from a file and never printed or put in a prompt
i learned that model slugs change without warning. the plain name sometimes does not exist and the live one has a date suffix. the check catches it before a night's work is wasted.
how to stop your invoice extraction prompt guessing due dates and tax basis:
most extraction prompts treat every field the same. the model fills them all in and moves on. the problem is that some fields aren't on the invoice at all, and the model will invent a plausible value rather than leave it blank.
paste these states into your extraction prompt for any field that might be missing:
for due_date:
- FOUND: print the date from the document
- DERIVE: no due date printed. calculate from payment terms if stated
- MISSING: no due date and no payment terms. leave blank
for tax_basis per line item:
- EXCLUSIVE: amounts are before tax
- INCLUSIVE: amounts include tax. recalculate the net
- UNKNOWN: cannot determine from the document. flag for review
for document_type:
- SINGLE: one invoice in the file
- MULTIPLE: split before processing
- NOT_AN_INVOICE: route out
when the model has a named state for "i don't know," it stops guessing. the wrong defaults are what cause mispayments and late fees.
how to cut token spend on long unattended agent builds:
move orchestration out of the model and into a script.
1. write the multi-step workflow as a shell script or a Python runner. each step calls the model for the part that needs judgment and passes the result to the next step in code
2. add a PostToolUse hook that runs your linter on every file the agent edits. the hook returns corrections before the next step starts
3. put a regulator in front of Bash: a script that inspects each command against your project rules before it runs, and explains what to do instead when it denies one
4. resume by reading the last checkpoint in plans/, not by restarting the conversation
the model does the thinking. deterministic code does the routing, the checks and the sequencing.
how to reverse engineer your own workflow into a build spec:
1. search your chat history for every conversation where you did the task end to end
2. also read the skill files you loaded in those sessions
3. ask for two layers: a plain walkthrough of what the user sees, then the technical reality of what made it work
4. make it list the non-obvious moves it makes that a default model would not
5. save it as one markdown spec
6. before building, ask: where is this spec wrong or thin?
the spec becomes the source of truth your coding agent builds from.
why this works: you describe your own workflow badly from memory. your chat logs recorded the real one, including the steps you no longer notice.
my rule: the build spec is in your history. you just haven't extracted it yet
how i'd run a mismatch audit before any filing or month-end:
give Claude three files: your bank export, your payment processor payouts, and your time tracking or billing log. then paste this prompt:
"compare these three sources. list only the places where they disagree. for each mismatch, name the source that says one thing and the source that says another. if a payment appears in one place and not the others, flag it. do not summarise what matches. do not do any calculations. just show me where reality and my records don't line up."
then take the mismatch list to whoever handles your books.
the AI reads three exports at once and spots the disagreements a single-system review misses. the mismatch list is where the missed deductions and unpaid items usually hide.
how to run a recurring agent job that doesn't drift:
long-running agent sessions pick up stale state. a nightly triage that inherits yesterday's context eventually acts on something that changed.
the fix is a prompt, a schedule, and a fresh workspace every run:
1. define the job as a prompt and a cron schedule
2. each tick spins up a new isolated workspace, runs the agent, throws the workspace away
3. a watchdog kills any run that hangs
4. the agent starts blank every time. no accumulated state
works for repo hygiene, daily digests, inbox triage. if the job needs memory between runs, write it to a file the next run reads on purpose
run your lead scoring prompt 10 times on the same lead right now. hash the outputs.
if they don't all match, every vague word in the prompt is a coin flip. replace "high value" with a number. replace "strong fit" with a closed list. rerun until 10 outputs are identical.
then test on 20 real records, because a repeatable policy can still be the wrong one
i score content by dividing each post's engagement by the median of the same author's 30 nearest posts. here's the method:
1. engagement = likes + reposts + replies + quotes + bookmarks. original posts only, not replies
2. for each post, take the 30 posts by the same author closest in time. leave the post itself out
3. baseline = median engagement of those 30
4. multiple = engagement / max(baseline, 1)
5. if fewer than 10 baseline posts exist, flag the score as an estimate
6. if the baseline posts are from a different period than the post, mark it "vs today" and add a toggle for same-period-only comparison
why: sorting by likes just finds big accounts. a nearest-in-time median cancels follower count and growth. the "vs today" flag is the non-obvious part. one stale comparison topped my whole file.
my rule: a post that beats its neighbours is interesting. a post with high likes just has a big audience
the research workflow that stops your agent inventing quotes:
1. state the research question and 3 to 6 claims you need answered. the agent stops once each claim has a source location
2. it chases citations backward and forward to the originals
3. it outputs only verbatim excerpts, never summaries
4. a script checks every excerpt appears word for word at the cited line. anything paraphrased gets halted
5. saturation stop: when two search paths mostly return what's already mapped, the research is done
the rule worth stealing: evidence pointers, not summaries. summaries are where research agents invent things.
add this to any research prompt: "output only verbatim excerpts. never summarise. cite the exact location."
i pointed Claude at my last month of chats and asked it to tell me what i couldn't see. here's the prompt:
pull my last 20 chats. not just this one.
look for behaviour patterns from a professional standpoint. i want the patterns, not advice on any single chat.
rules:
- every pattern must cite the specific chat event behind it. a date, a promise i made, a correction i repeated. no vague observations
- list what's working too, with the same evidence standard
- end with one forced decision: my single goal for the next quarter, based on what you found
chat history is a behavioural dataset. most people treat it as recall.
my rule: the evidence-per-claim rule is what stops this from being horoscope advice
the pinned trigger is the real finding. same idea as putting rules in CLAUDE.md itself: whatever the harness re-injects survives, a file the agent has to choose to open doesn't. claude code does this natively too, a SessionStart hook with the compact matcher runs your reload script for you. i'd go easy on the p^k table though, 4/7 is a thin base and compactions probably aren't independent
your coding agent now compresses old conversations after an hour idle. check two things before it loses something you need:
1. open /config and look for idle compaction. decide if you want it
2. move anything the agent must always know into CLAUDE.md itself, not a file CLAUDE.md points to
after compaction CLAUDE.md reloads from disk. everything the agent read because CLAUDE.md told it to gets folded into a summary. if the full text matters, it belongs in the file every session starts with
how to get a phone alert only when a coding agent needs you:
- run each agent in its own pane in a terminal multiplexer that tracks working, needs-you and done states
- reach the machine from anywhere over Tailscale and SSH
- when a pane flips to needs-you, a daemon pushes an encrypted alert to your phone
- your phone shows per-turn diffs and localhost previews over the same SSH link
- free alert options: herdr-web-ui (self-hosted, web push) or Heeler (open source, iOS)
my rule for any run over 20 minutes: if i can't get a phone ping when it's stuck, i don't start it
the one metric that turns "the agent is getting better" from a feeling into a number:
count how many times you step in per finished piece of work. re-prompts, corrections, review comments. lower is better.
classify each intervention against a list of named failure modes. when the same failure repeats across about 20 tasks, change the pipeline's own instructions to prevent it.
the number either goes down week over week or your setup is stalling and you are not seeing it.
@aksenHQ it stops and asks. it works through the plan one question at a time and won't move on while an answer is vague. if the codebase can answer a question it goes and looks instead of asking you. guessing is the thing it's there to stop
the loop that stops a coding agent building the wrong thing:
1. /grill-me. the agent interrogates your plan with hard questions before it writes a line
2. /to-spec. it turns the grilled answers into a spec
3. /to-tickets. the spec becomes work items
4. /implement. each item runs /tdd, red then green then refactor
5. /code-review
6. /pr
7. /retro
install into Claude Code, Codex and Cursor with one command:
npx skills add mattpocock/skills -a claude-code
leave out -a to choose agents. add -g for global. npx skills use <source> previews a skill's prompt without installing.
@eugeniominardi fair. for a one-line fix i go straight to implement too. the full loop earns its cost when the change touches an earlier decision, like you said, or when i can't yet say what done looks like
@SSShken everything it read off the PDF: supplier, invoice number, date, currency, net and gross. then the contact it matched and the account code and tax type it took from the last five purchases. i check that against the PDF and either approve or skip
how i'd automate receipt booking from scratch with a Claude Code skill and any accounting API:
1. ask the API for unused documents in the inbox
2. download each PDF. let Claude read it directly, no OCR step. pull the supplier, invoice number, date, currency, net and gross
3. look the supplier up in contacts
4. pull the last five purchases from that supplier. reuse their account code and tax type
5. show the proposal and wait. this is the only decision point
6. one API call creates the purchase. upload the PDF as an attachment
7. anything unresolved: skip it and move to next
the model only transcribes and your purchase history decides the codes. you approve each one.
limits: built for a sole trader. VAT-registered companies need per-line handling, a new supplier needs a one-time human decision, and at five receipts a month it might not pay off.
@DennisonBertram pretty much. if it can't match the supplier or the numbers don't add up, it skips that receipt and leaves it in the inbox. the API still lists it as unused, so it shows up again on the next run and i sort it by hand. nothing gets booked on a guess
how to know if an AI admin skill actually works before you trust it with real data:
1. build one fake month full of known traps
2. include a foreign currency charge where the statement shows a converted amount
3. a refund that should be skipped
4. a private card mixed in on the same account
5. two invoices with the same amount from different suppliers
6. a receipt that genuinely does not exist
7. run the model with the skill, then without it, on the same fake month
8. compare scores. the gap is what the skill bought you
building the traps takes longer than writing the skill. do it anyway. a documented gap you can fix is fine. a silent one will cost you.