Kord By Siranta
The free, open-source, token-efficient codebase packer. Flatten directories into structured XML files designed for LLM attention windows in under a second.
$ go install github.com/siranta-ai/kord@latest $ kord ./my-project --output context.xml Scanning 1,247 files... Filtering via .gitignore + .sirantaignore... Packing into XML tree... ✓ context.xml written in 0.48s (3.2 MB)
Visualizing the XML Aggregator
Kord walks your directory tree, resolves ignore parameters, skips binary structures, and bundles files into a token-optimized XML schema designed for LLM prompts.
Interactive Tree View:
Click any file or directory in the Source Workspace directory map on the right to see its packed output XML equivalent.
Stop drowning your LLM in raw context.
Feeding a codebase to an agent usually means writing brittle scraping scripts, blowing up token limits with minified files, and losing context structure. Kord solves this in 0.5 seconds.
// Drowning in raw files and token overflows
const files = glob.sync('src/**/*', {
ignore: ['node_modules/**', '.git/**']
});
let context = "";
for (const file of files) {
const content = fs.readFileSync(file, 'utf-8');
// Wait, did I just pass 3MB of minified JS to Claude?
// Is this going to blow up my context window?
context += `
--- ${file} ---
${content}`;
}
// Good luck getting the LLM to understand this mess.// 1. Run `kord . --output context.xml`
// 2. Pass the clean, token-optimized XML directly to your agent
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import fs from 'fs';
const kordContext = fs.readFileSync('./context.xml', 'utf-8');
const { text } = await generateText({
model: openai('gpt-4o'),
system: `You are an expert system architect.
Here is the structured codebase context:
${kordContext}`,
prompt: 'Refactor the auth middleware to use edge functions.',
});How Kord Compiles Context
A high-speed context assembly engine written in Go, optimized for low overhead.
Concurrent File Ingestion
Kord initiates a high-concurrency path walk utilizing Go routines and workpools. It crawls directories simultaneously, indexing filenames, metadata, and contents in milliseconds.
Priority Filters
Evaluates ignore parameters sequentially. Custom CLI patterns take precedence over local ignore config files.
Binary Filter
Scans file header blocks (first 512 bytes) looking for null-bytes to safely identify and skip binary media, assets, or database weights.
CDATA Shielding & Token Compression
Escapes formatting markup by encapsulating all raw text inside structured CDATA elements. Optionally removes redundant code whitespaces to compress character overhead and save attention tokens.
Live Command Builder
Customize your codebase bundling script live. Toggle parameters on the console panel to observe how the command string updates and watch the compiler logs adapt to your requirements.
Console Parameters
Command Flag Reference
Browse every flag and argument Kord CLI supports to tailor the packed context output to your prompt and LLM specifications.
--outputalias: -otype: stringdefault: stdoutWrites the generated codebase context to a specific file target instead of printing it to stdout.
$ kord . -o context.xml
--helpalias: -htype: booleandefault: falseDisplays detailed documentation, CLI syntax helpers, and descriptions of all arguments.
$ kord --help
--quietalias: -qtype: booleandefault: falseSuppresses logging output, warnings, and file processing progress reports. Useful for scripts.
$ kord . --quiet -o out.xml
Why Structured XML over Raw Text?
Concatenating directories using basic file dumping scripts often leads to lost context boundaries, where the LLM struggles to identify where one file ends and the next begins. Kord leverages structured XML schemas to resolve these core issues.
Standardized Pre-Training
Modern foundation models (such as Claude 3.5 and Gemini 1.5) are trained heavily on XML-delimited documents. They recognize `<file>` structures natively.
Positional Encoding Guardrails
Structured paths in XML attributes act as permanent positional anchors, helping attention blocks locate dependencies without losing track.
Strict Code Safety
CDATA wrappers ensure that standard code components containing brackets or scripting syntax are parsed as data rather than instructions.
<codebase> <!-- Global Metadata Headers --> <repository_metadata> <path>/workspace/siranta</path> <commits_summary>...</commits_summary> </repository_metadata> <!-- File Tree Structure (Table of Contents) --> <directory_structure> 📁 src/ 📄 index.ts </directory_structure> <!-- Structured Code Context Nodes --> <file path="src/index.ts" size="1.2KB" lines="40"> <![CDATA[ ... raw file content code ... ]]> </file> <file path="src/utils.ts" size="4.5KB" lines="150"> <![CDATA[ ... raw file content code ... ]]> </file> </codebase>
CI/CD PR Context
Integrate Kord into your GitHub Actions workflow to pack modified files on every pull request. Pass the XML bundle to an agent to automatically generate reviews, verify security issues, or check syntax requirements.
Automated Token Savings
By combining Kord with git diff commands, Kord will only bundle the changed code, saving up to 90% in LLM prompt tokens per PR.
name: AI Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Install Kord CLI
run: go install github.com/siranta-ai/kord@latest
- name: Pack PR Modifications
run: |
# Retrieve only modified files since PR branch origin
CHANGED_FILES=$(git diff --name-only origin/main...HEAD | tr '\n' ',')
kord . --ignore "$CHANGED_FILES" --output pr-context.xml
- name: Send Context to Agent
run: |
# Post the pr-context.xml to your LLM audit agent
curl -X POST https://api.siranta.com/v1/audit \
-H "Authorization: Bearer ${{ secrets.SIRANTA_API_KEY }}" \
-F "context=@pr-context.xml"Installation
Kord is compiled as a single self-contained Go binary. Install it in a single command on any environment.
Go Install
Requires Go 1.20 or later installed on your system.
go install github.com/siranta-ai/kord@latest
Build from Source
Clone the repo and build locally for full control.
git clone https://github.com/siranta-ai/kord.git cd kord go build -o kord .
Join the Open Source Initiative
Kord is fully open-source and built for the developer community. We believe in providing robust local tools to improve LLM efficiency. Help us improve the parser, add new CLI options, or build editor extensions.
CLI Roadmap
- Regex matching for advanced ignore rulesIn Progress
- Custom formatting templates (JSON, Markdown, YAML)Planned
- Incremental cache to skip unmodified filesPlanned
Need more than
context packing?
When your agents need persistent memory, graph relationships, and zero-trust security — explore Siranta Gateway.