agentleFS
LukehleLukehle/closeloop/skills/tie-out/SKILL.md

tie-out

Skill1 starsChanged 3 months agoMITView on GitHub

Prove a number end-to-end before anyone relies on it - source, transformation, control total, agreement to the general ledger or an external statement, with variance measured against a stated threshold. Use whenever a figure will be shown to a human, published, sent, or used for a decision, and whenever a query, extract, script, or model "ran successfully". Running is not proving. Trigger on "tie out", "does this number tie", "reconcile to GL", "check the numbers", "is this right", "verify the report", or before any deliverable leaves your hands.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before you report any number, you must be able to answer four questions with artifacts, not recollection:

    line 18
  2. Distinctive:

    What happened to it?: Every filter, join, aggregation, currency conversion, and manual adjustment between source and output.

    line 22
  3. Distinctive:

    If you cannot answer all four, the number is unverified.

    line 29
  4. Distinctive:

    Every deliverable ships one.

    line 36
  5. Distinctive:

    If the variance exceeds the threshold, the result is FAIL.

    line 82
  6. Distinctive:

    When a tie-out depends on a script, query, or test, capture the exit code.

    line 93
  7. Distinctive:

    If you cannot obtain an independent second source at all, the honest result is UNVERIFIED, with a statement of what source would be needed.

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tie-out

"The query ran" is not "the number is right." Mechanism success is not substance success. A pipeline that completes, a script that exits 0, a dashboard that renders, a file that saves — none of these are evidence about the figure. The only evidence is agreement with an independent source.

This skill produces that evidence in a fixed, auditable shape.


The core discipline

Before you report any number, you must be able to answer four questions with artifacts, not recollection:

  1. Where did it come from? Named system, named object, as-of timestamp.
  2. What happened to it? Every filter, join, aggregation, currency conversion, and manual adjustment between source and output.
  3. Does it foot? Does the total of the detail equal the reported total, and does the row count match expectation?
  4. Does it agree? Does it match an independent source — the GL, a bank statement, a prior-period roll-forward, a vendor portal — within a threshold you stated in advance?

If you cannot answer all four, the number is unverified. Label it that way. An unverified number presented as verified is the single most damaging thing this pack can produce.


The tie-out block

Every deliverable ships one. This is the fixed format — do not improvise a variant.

TIE-OUT | AR subledger to GL | period 2026-07 | as-of 2026-08-19T14:20Z

SOURCE
  A  bq://finance.ar_open_items    WHERE close_period = '2026-07'    rows 14,882
  B  sheets:GL_Extract!A1:H4200    revision 412, account 1200        rows 4,199

TRANSFORM
  A  sum(amount_usd) after fx conversion at 2026-07-31 month-end rate
     excluded: status IN ('void','draft')            -> 61 rows, $0 net
     excluded: intercompany counterparties           -> 340 rows, $1,204,551

CONTROL TOTALS
  A  detail sum        12,441,208.33   row count 14,481   (14,882 - 61 - 340) OK
  A  header/summary    12,441,208.33   MATCH
  B  GL account 1200   12,441,520.11

AGREEMENT
  variance            311.78          0.0025% of balance
  threshold           greater of $5,000 or 2%          -> $248,824
  result              PASS

  variance explained: 3 items posted 2026-08-01 with a 2026-07-31 effective date;
  listed in ./close-runs/2026-07/ar-timing.csv

NOT CHECKED
  - unapplied cash ($88,140) - owned by the cash rec, out of scope here
  - credit memos issued after 2026-08-15 - period not yet closed

RESULT  PASS (with the 2 scope exclusions above)

Every section is mandatory. A tie-out block with no NOT CHECKED section is a red flag — it claims total coverage, which is almost never true.


Threshold before result. Always.

State the threshold before you look at the variance. This is not a formality:

  • Threshold first, then result → you tested something
  • Result first, then threshold → you rationalized something

If the variance exceeds the threshold, the result is FAIL. A FAIL is a finding to investigate, not a number to widen the threshold around. Widening a threshold to make a variance pass is a falsification of the control, and it will be visible to anyone reading the run log.

The only legitimate reason to change a threshold is a documented decision made outside the run, recorded in pipeline-change-control, with a stated rationale.


Exit codes are evidence. Do not throw them away.

When a tie-out depends on a script, query, or test, capture the exit code. Piping output into a filter destroys it:

# WRONG - always exits 0 because head's status wins; a failure reads as a pass
python recon.py | head -50

# RIGHT - capture status, then look at output
python recon.py > recon.out 2>&1; status=$?
head -50 recon.out
echo "exit=$status"
[ $status -eq 0 ] || echo "TIE-OUT BLOCKED: recon.py failed"

The same applies to tail, grep, tee, and | head. In PowerShell, check $LASTEXITCODE immediately — before any other command runs, because it is overwritten.

Why this rule exists: a filtered command that swallows a non-zero exit produces a clean-looking transcript over a failed run. The report says "checks passed." Nothing passed.


The tells that a tie-out is fake

Watch for these in your own output. Each one means stop and redo the work:

TellWhat it actually means
"The reconciliation completed successfully"You reported the mechanism, not the substance
"The numbers look reasonable"No threshold was stated, so nothing was tested
"Variance is immaterial" with no figureImmaterial against what? Name the number
A total with no row countYou cannot tell a missing-rows bug from a correct result
Source described as "the report" or "the system"Not addressable; nobody can re-run this
No as-of timestampThe result is not reproducible, and a mismatch is undiagnosable
Every account passes on the first runSuspect the test, not the data
A prior-period figure carried forward uncheckedIt was right once; that is not evidence about now

Working procedure

  1. Declare scope and threshold. What is in, what is out, what tolerance governs. Write it down before touching data.
  2. Pull both sides independently. The whole point is independence. Deriving both sides from the same extract proves only that arithmetic works.
  3. Foot each side to itself. Detail sums to header; row counts reconcile to expectation after documented exclusions.
  4. Compare, and measure the variance in both absolute and percentage terms.
  5. Explain the variance, item by item, down to the investigation floor. "Timing differences" is not an explanation; three named items with dates and amounts is.
  6. State what you did not check.
  7. Emit the block. PASS, FAIL, or UNVERIFIED — those are the only three results.

Degraded mode

This skill needs no tooling. With no shell, no warehouse client, and no Python, the procedure is identical and manual: pull both sides by hand, foot them, compare, and write the block. The block format is the deliverable, and it is legible on any seat.

If you cannot obtain an independent second source at all, the honest result is UNVERIFIED, with a statement of what source would be needed. Never substitute a plausibility check for an agreement check and call it a tie-out.


Related skills

  • finance-guardrails — Rail 1 requires a tie-out block to accompany every staged action
  • reconciliation — builds the recurring recs that this skill proves
  • data-quality-gate — catches the upstream problems that make a tie-out fail
  • three-statement — the tie-out rules specific to BS/IS/CF linkage

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.