Intents and dedup
An intent is the coordinator’s record of one task. It holds what the coordinator read from your prompt (the ticket, the repository paths, and the content words), who asked, and what became of the task. Its status is one of active, queued, merged, watching, escalated, done, or abandoned.
Before zt start launches an agent, the coordinator compares your prompt with the project’s other intents. This is dedup, the first of the three catches. When nothing matches, the intent is new and the session starts. When something matches, the coordinator offers choices. zt start asks you to pick one on a terminal, and exits with code 2 everywhere else.
How it works
Section titled “How it works”The check
Section titled “The check”POST /v1/projects/{project_id}/intents/check runs a check and stores nothing. POST /v1/projects/{project_id}/intents runs the same check again under a lock and registers the intent. A check has these steps:
- The heuristic extractor reads the prompt. It always runs and produces
normalized_text(lowercase content words),touched_areas(repository paths the prompt names, up to 50), andticket_ref. A prompt over 16 KiB is refused. A prompt with nothing to match on fails with “the prompt has no words, ticket, or paths to match on”. - The LLM extractor runs only when
ZENTRI_LLM_STEPSincludesextract. It adds a one-linesummaryand extra touched areas. It may demote a ticket to a passing mention, and it can never add one. An answer that names a ticket the prompt lacks is discarded whole. - The embedder turns
normalized_textinto a vector. The text that gets embedded always comes from the heuristic, so a prompt embeds the same way whether or not the LLM answers. - The coordinator gathers candidates from the same project with status
active,queued, ordone. It takes up to 20 nearest vectors from the same embedding model, up to 50 intents with the same ticket, and up to 50 that share a touched area. - The judge reads the closest candidates, when it is on (see the judge).
- Each candidate gets a class and a score. The coordinator ranks them by class, most blocking first, then by score, and keeps the top 5. The first one sets the check’s
classification.
Classes
Section titled “Classes”| Class | When |
|---|---|
active_duplicate |
Same ticket, or cosine at or above duplicate_cosine with no differing tickets, and the match is active or queued. |
already_done |
The same rule, and the match is done. |
partial_overlap |
Cosine at or above partial_cosine, or touched-area Jaccard at or above area_jaccard. |
new |
Nothing above. |
A candidate’s score is the higher of its cosine and its area Jaccard, or 1 when the ticket is the same.
Thresholds
Section titled “Thresholds”The defaults depend on the embedder. A model name that starts with hash- gets the hash column.
| Threshold | hash |
ollama, openai |
|---|---|---|
duplicate_cosine |
0.79 | 0.95 |
partial_cosine |
0.79 | 0.95 |
area_jaccard |
0.5 | 0.5 |
judge_cosine |
0.3 | 0.4 |
dedup_window_ms |
5000 | 5000 |
dedup_cosine |
0.97 | 0.97 |
A lead overrides them per project with PUT /v1/projects/{project_id}/intent-thresholds. GET on the same path returns effective, defaults, and override. A PUT replaces the whole override and is audited as intent_thresholds.update. Values must be in (0, 1], partial_cosine must not exceed duplicate_cosine, and dedup_window_ms runs from 0 (off) to 600000. The same body takes up to 10 ticket_patterns, which replace the defaults. Calibrating dedup shows how to pick values.
Ticket roles
Section titled “Ticket roles”A ticket decides a duplicate only when it is the task’s subject. The default patterns read ENG-101 style IDs and #123. A cue word near a ticket in the same sentence marks it as named in passing. The extractor reads the 4 words before the ticket for cues such as “see”, “blocked by”, “depends on”, “fixed in”, “instead of”, and “also”. It reads the 3 words after it for cues such as “already”, “shipped”, “merged”, “is rewriting”, and “touches”.
The first ticket that is not named in passing becomes ticket_ref. Passing tickets are not stored. A lowercase ID such as led-512 counts only when the prompt has no other ticket, and only on an exact match with a stored intent.
The judge
Section titled “The judge”The judge is an LLM that reads two prompts and answers same, overlap, or different. It runs when ZENTRI_LLM_BASE_URL is set, ZENTRI_LLM_STEPS includes judge (the default), and the coordinator holds a data key. It takes the 3 closest candidates that have a stored prompt. It reads each one whose cosine is at or above judge_cosine and below duplicate_cosine, and where no ticket on both sides decides the match. A candidate at or above duplicate_cosine stays a duplicate whatever the prompt says. A same answer is asked again with the texts swapped, and the second answer stands, so a check makes up to 6 calls. A prompt over 4 KiB on either side is left to the thresholds. The judge stops at its first failure.
Choices
Section titled “Choices”The class and who owns the match decide which resolutions you may pick. The default is what --yes takes.
| Match | Choices | Default |
|---|---|---|
active_duplicate, your own intent |
merge, queue, run_anyway, fork |
none |
active_duplicate, another user’s intent |
join_as_watcher, escalate |
join_as_watcher |
active_duplicate, made by the judge alone |
join_as_watcher, escalate, run_anyway |
none |
already_done |
run_anyway, escalate |
none |
partial_overlap |
run_anyway, queue |
run_anyway |
merge makes a merged intent and starts no session. queue makes a queued intent that waits for the match to end. join_as_watcher makes a watching intent and sends an intent_watcher notice to the owner and the owner’s live session. escalate makes an escalated intent and sends an intent_escalated notice to up to 50 users with the lead role in the organization, or to its admins when it has no leads. run_anyway and fork start a session, and run_anyway is audited with the ignored intent’s ID. A requester never starts an agent, so fork is removed and run_anyway becomes queue.
Atomic registration
Section titled “Atomic registration”Registration takes a Postgres advisory lock per project (pg_advisory_xact_lock) and runs the match again inside it. Two identical prompts registered at once therefore see each other. A test fires 20 parallel registrations of one prompt and gets exactly one new.
The dedup window catches a double submit. Take an active or queued intent registered in the last dedup_window_ms, with the same normalized_text or a cosine at or above dedup_cosine. The check treats it as an active_duplicate with score 1 and a reason such as “registered 120ms ago with the same text”. Inside the window, run_anyway and fork are refused with resolution_not_allowed.
Degraded mode and re-embed
Section titled “Degraded mode and re-embed”Each model call has ZENTRI_MODEL_TIMEOUT (default 5 s), and one check spends at most 25 s on models. A failed LLM extractor leaves the heuristic’s output. A failed embedder leaves matching on ticket and touched areas only, and the intent is stored without a vector. The check then reports degraded: true and degraded_steps. When zt start describes a match, it adds a line such as (matching ran degraded: embed). zentri-server serve re-embeds intents without a vector every --reembed-interval (default 1m), 32 at a time.
What goes to a model
Section titled “What goes to a model”| Step | Runs when | Receives |
|---|---|---|
hash embedder |
ZENTRI_EMBEDDER unset or hash |
Nothing. It runs inside the coordinator. |
ollama, openai |
ZENTRI_EMBEDDER names it |
normalized_text, not the raw prompt |
| LLM extractor | extract is in ZENTRI_LLM_STEPS |
The raw prompt |
| Judge | judge is on and the data key is set |
The raw prompt and up to 3 stored raw prompts |
The same LLM also runs two steps outside dedup. The phrase step sends it an agent’s question and the task’s summary (see questions and decisions). When a lead sets "llm": true in the project’s model router, it also gets the prompt of each API-key session that no router rule decides.
The coordinator’s operator points it at these services, and their API keys are read from files (ZENTRI_EMBED_API_KEY_FILE, ZENTRI_LLM_API_KEY_FILE). They are not your agent’s credentials. Every user brings their own agent credentials, and Zentri never collects, proxies, stores, or resells model access or consumer subscription tokens.
Raw prompts
Section titled “Raw prompts”The coordinator stores a raw prompt only when ZENTRI_DATA_KEY_FILE names a 32-byte key (raw, 64 hex characters, or base64). It seals each prompt with AES-256-GCM, bound to the project and intent IDs. Without the key nothing is stored and the judge is off. An intent’s JSON shows raw_prompt_stored, and GET /v1/intents/{intent_id} returns raw_prompt to the owner and to an admin.
Measured quality
Section titled “Measured quality”The offline default (heuristic extractor and hash) catches the same ticket and near-identical wording, but no paraphrase. On 349 labeled training pairs it matched 0 of 73 paraphrases, and a semantic embedder alone did no better.
The documented local setup runs embeddinggemma:300m and the qwen3:4b-instruct judge on Ollama. On a fresh held-out set, scored once on a laptop without a GPU, it found 38 of 60 active duplicates and called 4 other pairs duplicates (precision 0.905, recall 0.633). That misses the target of 0.95 and 0.80. Four of its six false duplicates and false finished work came from a ticket named only in passing, which the judge does not read. A check took 5.4 s at the median and 10.8 s at p95, and 13 of 504 judge calls failed at the 5 s timeout. No OpenAI-compatible endpoint was measured.
Use it
Section titled “Use it”When a decision is needed and zt start cannot ask, it exits 2 and names the choices. This output is from the README:
$ ben zt start "ENG-101: add CSV export to the reports page" < /dev/nullThis task matches existing work (active_duplicate). intent f4414369 active @ana score 1.00 ticket ENG-101 session 8d918b06 eng 101 add csv export reports pageChoices: 1) join_as_watcher watch the owner's work; the owner is told (default) 2) escalate ask the project leads to decideerror: a decision is needed; rerun with --resolution set to one of join_as_watcher, escalate, or --yes to take join_as_watcher$ echo $?2$ ben zt start --yes "ENG-101: add CSV export to the reports page"You now watch @ana's work on intent f4414369. @ana was notified.On a terminal, zt start prints a numbered list and Enter takes the default. With --json, --yes, or no terminal it never asks. Pass --resolution NAME to pick a choice, or --yes to take the default. --yes on a match with no default also exits 2. zt ls lists the project’s intents.
Maintain the pipeline with zentri-server intents:
# Score the classifier on the labeled pairs. Needs no database.zentri-server intents calibrate --dataset examples/intents/pairs.jsonl# Embed intents that have no vector. --all also replaces vectors from another model.zentri-server intents reembed --allRun reembed --all after you change ZENTRI_EMBEDDER or ZENTRI_EMBED_MODEL. To store raw prompts and turn the judge on, write a key to a file. Mount it read-only into the coordinator with a Compose override file, and set ZENTRI_DATA_KEY_FILE to its path inside the container, for example /run/secrets/zentri-data-key.
openssl rand -hex 32 > zentri-data-keyEnvironment lists every variable, and server CLI every flag. The HTTP API reference lists every endpoint.
Limitations
Section titled “Limitations”- The offline
hashembedder catches no paraphrase. Reworded duplicates need the judge. - The local judge setup misses the M2.5 target of precision 0.95 and recall 0.80.
- The judge reads only prompts stored while the data key was set, and skips any prompt over 4 KiB.
- A ticket named in passing with no known cue still makes false duplicates or false finished work.
reembedembeds the storednormalized_textofactive,queued, anddoneintents. It does not run the extractors again.- Nothing starts a
queuedintent by itself. You start it withzt start --queued(see sessions and forks). - An
escalatedintent runs no agent, and noztcommand acts on the escalation. zthas no command for thresholds. You read and set them over HTTP.
Related pages
Section titled “Related pages”- Three catches places dedup next to file claims and the merge check.
- Sessions and forks covers what happens after an intent starts a session.
- Two engineers, same task walks through a duplicate end to end.
- Calibrating dedup explains how to tune thresholds for your project.
- Server CLI reference lists every
zentri-server intentsflag. - Configuration reference and environment reference list the model settings.