datapulse-my / scripts
AGENTS.md3 starsChanged 3 months agoMITView on GitHub
Working agreement for AI agents editing the 133 Python scripts that drive the datapulse-my pipeline. scripts/ contains the build pipeline. Each script does one thing: - gen_*.py regenerate artifacts from upstream sources (timer-tick runs them) - verify_*.py enforce invariants (release-blocking) - validate_*.py check schema/content - embed_*.py render the dashboard HTML - check*.py operator smoke-test entry points Scripts are read-and-execute: every commit triggers the deterministic-safety-net gate which runs all *tests*.py. A bad script breaks the deploy pipeline within 5 minutes.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .attestations/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- mcp/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
One script = one job: If a script does two unrelated things, split it.
- Very specific: line 21
The 10-status taxonomy is hard-coded across multiple files: If you change it, you MUST update: embed_dashboard_data.py (status display), …
- Very specific: line 35
Atomic writes: every generator writes to <path>.tmp then os.rename(<path>.tmp, <path>).
- Very specific: line 36
Schema validation: every generator validates input JSON against health.schema.json or datapulse.schema.json before reading.
- Very specific: line 91
When writing a codex brief that touches any scripts/*.py:
- Distinctive: line 95
Does the change touch the 10-status taxonomy?: STOP and surface to operator first
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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.
Files
AGENTS.md — scripts/ (DataPulse MY pipeline)
Working agreement for AI agents editing the 133 Python scripts that drive the datapulse-my pipeline.
What this is
scripts/ contains the build pipeline. Each script does one thing:
gen_*.pyregenerate artifacts from upstream sources (timer-tick runs them)verify_*.pyenforce invariants (release-blocking)validate_*.pycheck schema/contentembed_*.pyrender the dashboard HTMLcheck*.pyoperator smoke-test entry points
Scripts are read-and-execute: every commit triggers the deterministic-safety-net gate which runs all *tests*.py. A bad script breaks the deploy pipeline within 5 minutes.
Hard rules
- One script = one job. If a script does two unrelated things, split it.
gen_health_history.pyregenerateshealth/history.jsonl; it does not also regeneratechangelog.json. (That'sgen_changelog.py's job.) - Every artifact is a generator output; nothing is hand-authored. Generated, and never hand-edited:
health/,record-evidence/,.attestations/,data/,docs/index.html,datapulse.json,changelog.json,mcp.json,catalog-snapshot.json..attestations/chain_head.jsonis generated too —gen_attestations.pyis its only writer (rule 5), and an earlier revision of this rule listed it as hand-authored in the same document that names its generator, which is the contradiction this rule now forbids. Sources —scripts/,config/,templates/, the two schema files — are authored once and then read by generators and validators; they are not artifacts and nothing regenerates them in place. Where a file has no generator yet (datapulse.schema.json,health.schema.json, and the manifest's dataset rows), that is a gap to close with a generator, not a licence to edit it by hand. - Never bypass
--quick-test.gen_health_history.pyand similar long-running scripts have a--quick-testflag for fast iteration. The flag is mandatory during dispatch — a 60-min full run wastes Codex quota. - The 10-status taxonomy is hard-coded across multiple files. If you change it, you MUST update:
embed_dashboard_data.py(status display),gen_changelog.py(status sections),gen_dashboard_filters.py,gen_dashboard_sections.py,health.schema.json, andmcp/server.py(status enums). Use a shared constant — don't repeat the tuple. - Attestation chain integrity is non-negotiable.
gen_attestations.pyis the only writer to.attestations/chain_head.json. Re-running with different inputs produces a different chain head — that's expected, but never edit chain_head.json directly. The release pipeline (.github/workflows/release-please.yml) asserts the chain head is stamped on each release; manual edits will break release attestation. git addorder matters for the safety-net gate. The gate compares pre/post SHAs to determine diff scope. If you regenerate artifacts and then commit them in the same dispatch, the diff scope includes your source change + regenerated artifacts. This is fine for the timer; for operator commits, separate the source change from the regen into two commits.- Determinism is load-bearing. Two runs of any
gen_*.pyon the same inputs must produce byte-identical output. If your script introduces non-determinism (random IDs, timestamps, sort instability), the deterministic-safety-net fails and the release is blocked. - Output paths go to a small allowlist (
scripts/_artifact_paths.pyor equivalent). New output paths must be added there before the safety-net accepts them.
Style conventions
- Shebang:
#!/usr/bin/env python3on every file. - Imports:
from __future__ import annotationsthen stdlib/third-party/local in 3 groups, alphabetised within each group. Absolute imports preferred. - Type hints: required on all public functions;
mypy --strictclean for new code. Internal helpers can use less strict typing. - CLI:
argparsewith--quick-test,--out <path>,--in <path>consistently. Nosys.argvslicing. - Logging: stdlib
loggingwith module-level logger named after the script (logging.getLogger(__name__)). Neverprint()in pipeline scripts — operators want log levels. - Errors: raise typed exceptions (
ConfigError,SourceError,SchemaError) with descriptive messages. The deterministic-safety-net reports failures via test output, not Python tracebacks. - Atomic writes: every generator writes to
<path>.tmpthenos.rename(<path>.tmp, <path>). Partial writes must never be visible at<path>. - Schema validation: every generator validates input JSON against
health.schema.jsonordatapulse.schema.jsonbefore reading. Failed validation = explicit error, not silent coercion.
Script-by-script taxonomy
| File | Pattern | Inputs | Outputs | Test command |
gen_changelog.py | gen | datapulse.json, health/latest.json | changelog.json | python3 scripts/gen_changelog.py --quick-test |
gen_health_history.py | gen | health/latest.json history | health/history.jsonl | --quick-test runs on 30 rows |
gen_dataset_deltas.py | gen | health/history.jsonl | health/deltas/<cycle>.json | --quick-test skips >1000 cycles |
gen_drift.py | gen | health/history.jsonl | health/drift.json | -- |
gen_attestations.py | gen | health/latest.json, prior chain head | .attestations/latest/<date>.json, chain_head.json | --quick-test skips signing |
gen_anomaly.py | gen | health/history.jsonl | health/anomalies.json | -- |
gen_catalog_snapshot.py | gen | datapulse.json | catalog-snapshot.json | -- |
gen_catalog_graph.py | gen | datapulse.json | data/catalog-graph.json | -- |
gen_dashboard_filters.py | gen | datapulse.json | docs/.dashboard_filters.json | -- |
gen_dashboard_sections.py | gen | datapulse.json | docs/.dashboard_sections.json | -- |
gen_health_methodology.py | gen | health/methodology.json | docs/health-methodology.html | -- |
gen_mcp_reference.py | gen | mcp/server.py AST | mcp.json at repo root | -- |
embed_dashboard_data.py | embed | datapulse.json, health/latest.json, docs/.dashboard_*.json | docs/index.html | python3 -m pytest scripts/tests/test_embed_dashboard_data_shell.py -v |
verify_release_reproducible.py | verify | all generated artifacts | exit 0/1 | --rebuild-and-diff |
verify_repository_contract.py | verify | repo invariants | exit 0/1 | -- |
verify_public_internal_refs.py | verify | tracked public files | exit 0/1 | -- |
verify_mcp_deployment.py | verify | live MCP endpoint | exit 0/1 | -- |
validate_policy_schema.py | validate | ~/.config/datapulse/policy.yaml | exit 0/1 | -- |
validate_at_runtime.py | validate | various | exit 0/1 | -- |
compare_health.py | compare | two health/latest.json | exit 0/1 | -- |
check.py | check | repo state | exit 0/1 | -- |
check_heartbeat.py | check | timer activity | exit 0/1 | -- |
check_url_drift.py | check | upstream URLs | exit 0/1 | -- |
fact_lint.py | lint | docs/ claims | exit 0/1 | -- |
lint_docs_against_units.py | lint | docs/ vs units | exit 0/1 | -- |
shape_fingerprint.py | util | dataset CSV | fingerprint dict | -- |
probe_gtfs.py | probe | GTFS feeds | health probe | -- |
run_health_canary.py | probe | smoke test | exit 0/1 | -- |
init_keys.py | bootstrap | (none) | Ed25519 keypair | idempotent |
bump_mcp_source_version.py | bump | mcp.json | mcp.json (bumped) | -- |
verify_mcp_deployment.py | verify | live MCP endpoint | exit 0/1 | -- |
verify_release_reproducible.py | verify | full pipeline re-run | exit 0/1 | --rebuild-and-diff |
(Full file list is in ls scripts/*.py; this table covers the load-bearing ones.)
What is NOT in scripts/
- The installed pipeline entrypoint —
scripts/datapulse-pipeline.shis maintained here and deployed to/usr/local/sbin/datapulse-pipeline.shbyscripts/install-pipeline.sh. The service must not execute it from the checkout because each cycle checks out artifact commits in that same tree. - The deploy flow —
.github/workflows/deploy-cloudflare-pages.yml(Cloudflare Pages; separate concern) - The public MCP server code — that's
mcp/server.py, not scripts
Out of scope
- Anything that touches upstream data (the probe scripts are read-only by design)
- Anything that writes outside the
health/,record-evidence/,.attestations/,data/,docs/,changelog.json,mcp.json,catalog-snapshot.jsonallowlist - New long-running scripts without a
--quick-testflag — the deterministic-safety-net will fail if you can prove determinism in <5 minutes
Pre-flight checklist (for dispatch briefs)
When writing a codex brief that touches any scripts/*.py:
- Which script(s) change? file + line range + which inputs/outputs are affected
- What does the regeneration cascade look like? list downstream consumers (e.g.
embed_dashboard_data.pyreadsgen_dashboard_*.json) - Does the change touch the 10-status taxonomy? STOP and surface to operator first
- Is the script deterministic? brief must explicitly state "two runs on same input → byte-identical output"
- What's the
--quick-testplan? brief must include the command - What does the deterministic-safety-net gate look like after the change? brief must include the expected
pytest scripts/tests/output - Workdir: absolute path to this repo
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
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.

