An agent that repeats a task leaves traces: what it did, in what order, and whether it worked. This project stores 200 of those traces as a graph in Relate, the embedded graph database for AI agents, and computes the compressed skill, the shortest verified method for the task, entirely from graph queries.
Entry for the Relate by Neo4j Hackathon on Devpost (December 2026).
The compression this project exists to compute is a set of relationship questions, not file scans:
- Which action sequence do the successful runs share, per job? A traversal from Run through its Steps in order.
- Which action must come immediately before
schedule? An adjacency pattern overNEXT_ON_JOBedges. In the graph it is one query (below), and the answer ischeck_tech_skillin 183 of 183 scheduled jobs in successful runs. In a flat file this is a hand-rolled scan, and it is exactly the kind of ordering fact that a sequence-only view keeps losing. - When is
reverify_customerworth doing? Runs flagged provisional, split by whether a reverify step exists in the graph: success 1.0 with it, 0.0 without it, across 155 provisional episodes. - Why not the alternatives?
HAS_FAILUREedges counted per cause give the exclusion evidence the skill carries.
Relate fits because it is embedded: no server, no signup, the whole trace
graph is one file a judge can copy, open read-only, and query. The same
Cypher runs through the Python library (relate-db) and the relate CLI.
Mode: single file (traces.rl, committed to this repo). Chosen because
the submission unit is one trace set: one file is inspectable, portable, and
versioned with the code that built it. In-memory mode was rejected because
the hackathon requires a persistent store judges can explore, and a
directory store adds moving parts a single self-contained file does not need.
From Dispatch Day, a simulated home-service dispatch task. Each episode is one run of an agent policy working 6 jobs, recorded step by step with the ground-truth outcome.
(:Run {run_id, policy, seed, success, margin, completed, eligible_total,
n_steps, had_provisional, had_oos, had_ineligible})
(:Step {idx, job, verified, approved})
(:Action {name})
(:FailureCause {name})
(Run)-[:HAS_STEP]->(Step)-[:PERFORMS]->(Action)
(Step)-[:NEXT]->(Step) consecutive steps within a run
(Step)-[:NEXT_ON_JOB]->(Step) consecutive steps on the same job
(Run)-[:HAS_FAILURE {job}]->(FailureCause)
The graph holds 200 runs, 9,115 steps, 13 distinct actions, and every recorded failure: 40 runs succeeded, 160 failed, and the failures are the evidence base for what the skill tells the agent not to do.
Requirements: Python 3 with pip install relate-db (tested with 1.0.1),
or the relate CLI (curl -sSfL https://relatedb.ai/install.sh | bash).
Query the committed store with the CLI, read-only:
relate --database ./traces.rl --read-only --mode table \
"MATCH (r:Run) RETURN count(r) AS runs"
relate --database ./traces.rl --read-only --mode table \
"MATCH (r:Run)-[:HAS_STEP]->(s1:Step)-[:NEXT_ON_JOB]->(s2:Step),
(s1)-[:PERFORMS]->(a:Action),
(s2)-[:PERFORMS]->(:Action {name: 'schedule'})
WHERE r.success RETURN a.name AS before, count(*) AS n ORDER BY n DESC"
Regenerate the skill from the store:
pip install -r requirements.txt
python compress.py # writes skill.json and SKILL.md
Rebuild the store from the raw traces:
python ingest.py # reads traces_v2.jsonl, rebuilds traces.rl
compress.py reproduces, from Cypher queries only, the exact output of the
original flat-file compressor for this corpus (verified field for field
against its published skill.json): a 9-action core method per job, the
provisional reverify rule, the check-before-schedule ordering rule, and the
failure-cause counts. See SKILL.md for the compressed skill itself.
- The traces come from a simulated task with programmatic ground truth, not from production agents. The claim is about representation and queryable compression, not about proven improvement on real workloads.
- "Shortest" means shortest among observed verified successes in the graph, not a proof that no shorter method exists.
- Attribution is correlational: an action present in every success is a candidate requirement, and the skill labels its evidence rather than claiming causation.
- Whether an LLM agent follows the emitted SKILL.md better than a verbose procedure is a separate experiment; a first test of that with a small local model did not pass its bar, and that result stands as recorded.
ingest.py— buildstraces.rlfromtraces_v2.jsonlcompress.py— the Cypher compression queries; emitsskill.json,SKILL.mdtraces.rl— the persistent Relate store (single file)traces_v2.jsonl— the 200 raw tracesSKILL.md/skill.json— the compressed skill, generated
Apache 2.0. See LICENSE.