Paper
CTIIntel as CodeCIAgentsPrompt Injection

CTI as Code: The Intelligence Program as Version-Controlled Records

Status: part built, part designed. The record contracts, a validator, the commands that read them, a deterministic sanitiser and a worked example are built and tested. The larger systems around them are designed and not built. The code is at https://github.com/jhanna2/cti-as-code.

Why this matters to the argument

In the essay I argue that when attacker capability stops varying, prediction from actor history loses most of its preventive value, and what remains of threat intelligence is small: requirements, intent, warning, collection conduct and the rules every handoff runs on. A small function has to run at machine speed, because the people who do the handoff work will not scale with the volume. This piece describes one way to run it, and it is the part of the series that exists as code.

Two key judgments, with confidence:

  1. The part of CTI that keeps it from being agentic is the program's own state, not the models. Confidence: moderate to high.
  2. Holding that state as records under CI makes agent help safe to accept and makes the program's gaps visible. Confidence: moderate. I have built the checks and not measured what they change in a real program.

The problem

Detection engineering moved its rules into version control years ago. A detection is a file, it is reviewed as a pull request, and CI refuses one that does not parse or does not fire on its own true positive.

The intelligence program has usually not made the same move. The requirements sit in a slide deck, the collection plan in a spreadsheet, a campaign on a wiki page. None of these can fail. They go stale quietly, and the program learns they were wrong when an incident asks one of them a question.

The lopsided part is where the effort goes. Collection and processing have been automated for years, and the platforms sell exactly that. Analysis has been partly automated, and models do it well: turning prose into techniques, extracting indicators, clustering reporting, drafting an assessment. Program management has not been touched. Setting and maintaining requirements, knowing which sources answer which of them and which answer nothing, noticing a requirement that has lost its consumer, tracking what the program cannot see, and deciding what automation may do unattended: that work takes much of a lead's time and has the largest effect on whether the function changes anything. It is held in prose, spreadsheets and people's heads.

Models read prose, so reading is not the obstacle. Writing is. An agent can summarize a collection plan kept in a spreadsheet. It cannot safely change one, because nothing reviews the edit, nothing fails when the edit leaves a requirement unanswered, and nothing records why it happened.

The approach

Coding agents became useful because software already had the environment an agent needs: a repository to read, tests and CI that say whether a change is correct, and pull requests through which a person approves what lands. The agent proposes, the build checks, a human signs. The idea here is to give the intelligence program the same environment.

The program becomes a repository of records. A priority intelligence requirement is a YAML file that names the decision it serves and who makes it. Each question under it resolves to a collection source or names a gap. Decoys, detection candidates and campaigns each point back up to a requirement. An agent is a record too, with a contract it must satisfy before it may run. CI enforces the claims the records make about each other, and one command walks the whole chain.

The example in the repository is a fictional freight-booking platform. Every name in it is invented, and it is small on purpose: a few records of each kind, with some requirements only partly sourced and one that leads with two gaps that have no source at all. That is the shape a real program has early on. This is what the commands print for it:

$ ctiac trace example/
PIR coverage (requirement -> collection):
  PIR-03  EEI-03-1  <- SRC-04
  PIR-03  EEI-03-2  <- SRC-01  PARTIAL: Partial only. SRC-01 sees actors that get written up publicly…
  PIR-06  EEI-06-1  <- GAP: No source. This inventory usually lives in contracts and integration…
  ...
Campaigns (cross-tier corroboration):
  CAMP-01  CAMPAIGN-001  spans 3 tier(s): external-open, external-shared, internal-deception
  CAMP-02  CAMPAIGN-002  spans 1 tier(s): internal-telemetry  <- single-tier, weakly corroborated

A GAP line is correct output. The failure is a requirement with neither a source nor a named gap, because an unnamed gap looks like coverage.

A change the gates refuse

The repository has a walkthrough of an agent proposing a new requirement. It reads well. It also cites an actor class that does not exist and a source that does not exist. The validator, run in CI, prints:

FAIL [requirements] PIR-09: threat_profile_ref 'ACTOR-09' resolves to no CJ or ACTOR
FAIL [requirements] PIR-09: EEI EEI-09-1 has neither a resolvable source nor a named gap

and exits nonzero, so the pull request cannot merge. Neither failure needed a person or a model to find. The corrected version points the reference at a class that exists, cites the ticket source that holds part of the answer, and names what is still missing. The program gets one more named gap, and ctiac gaps lists it with the rest. The agent that drafted the proposal is not in the repository. The gates that refused it are.

The principles I would defend

The repository states eleven. Five carry most of the argument.

A gap is named, or the build fails. This gate matters most because the failure it prevents is common: pointing a requirement at whichever source happens to exist and reporting it covered. Named gaps are also the most useful output the program produces. Printed together they are the case for each new source, purchase or hire.

Every record publishes its own blind spot. A detection candidate carries a non-empty list of what it does not cover. An agent declares where it is known to fail. A suspected overlap between an internal cluster and a publicly named actor must say what knowing it would change, and "nothing" is a permitted answer that has to be written down. Pitching a detection without stating what it misses is how coverage numbers start to lie.

A gate without a negative test is a comment. Every rule in the validator has a test that constructs the forbidden shape and checks that it is refused. A related rule: an empty result is an error. Run against the wrong directory, the validator finds no records, and reporting "0 violations" would be a green build that read nothing.

Authority follows determinism. A deterministic, reproducible check may sit in the path and block. A model's judgment may only raise a flag for review. The sharpest case is sanitization. The stage that decides what a model may see of text an adversary wrote for the purpose cannot itself be a model, because that moves the injection one step earlier onto a more privileged victim. The sanitizer in the repository is a static transform. A planted prompt-injection article goes in, five injections are stripped, the two genuine claims survive, and the item is flagged so it routes to a person and not to the auto-dismiss the injection asked for. A golden test holds the published output to the code byte for byte.

Agents are records, and untrusted input never runs autonomously. An agent must have a contract before it runs: its trigger, its approval level, whether it reads text an adversary can influence, where its evaluation set lives and where it is known to fail. The gate that carries the weight is one line. If an agent reads untrusted input and its approval level is autonomous, the build fails. Intelligence work reads text written by the adversary, so an agent that does so and may act without review is a channel for arguing into the automation. In the example, the extraction agent reads scraped reporting and needs review. A second agent, which only summarizes the program's own reviewed records, may run unattended, and the contract says why.

Writes are pull requests. Agents read the trees. If one wants to change the program, it opens a pull request validated by the same gates as a human commit, and a person signs it. Adjudicated cases are stricter: a case record with no human reviewer fails, because once an agent writes its own precedent the learning loop amplifies its own errors.

What is built, and what is designed

Built and tested: the eight record trees and a worked example; a validator enforcing every gate marked enforced in the contracts document, each with a negative test (42 tests in all); the validate, trace, gaps and report commands; the deterministic sanitizer with its golden test; a decoy canary predicate; and CI running all of it.

Designed and not built: the read API, the model-driven extraction pipeline, a filter audit that scores what a collection filter drops against the requirements, actor clustering and ranking, the sharing pipeline, and the retrieval and drift loop over adjudicated cases, along with drift detection and a drift budget for self-tuning controls. They are specified with their gates, and nothing has run against real telemetry. Every fixture is synthetic.

What would make me wrong

The gates can be gamed. If records start being written to satisfy the checks and not to describe the program, gaps get named vaguely enough to pass. The remedy in that case is fewer gates, not more. A requirement that passes every gate can still be the wrong requirement; the gates enforce the program's honesty about itself and do no analysis.

The overhead may exceed the value. A small program with a few requirements may find that a document is cheaper to keep than a repository. I expect the break-even to depend on how many consumers and sources there are, and I have not measured it.

Models may not need the structure. If agents become reliable enough at editing prose that review and checking add little, the argument for records weakens, though determinism and diffability would still matter for audit.

I have not run this in a real program. The example is fictional, so it shows that the checks work and cannot show that they improve outcomes. The experiment that would count is a real program run under these gates for a stretch, measuring whether named gaps turn into sources and whether stale requirements are caught earlier than before. I will publish the result either way.

Where it connects

The essay says what remains of the function after the shift; this is how it runs. The agent-first TIP is the platform that would sit under these records. Agentic IAM covers what an agent may touch once it runs. The detection paper hands detection a priority built from paths and not from actors, and a detection with an owner, a path it serves and a last-validated date is a record this repository's checks could verify.

← All Writing