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.

Terminal
$ 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)
High Fidelity Context

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.

Source Workspace1,247 Files
src/
components/
lib/
* Click elements to inspect parser mapping actions. Ignored items are excluded before token accumulation.
XML Output Structure1 XML File
<codebase> <!-- Generated with Kord CLI --> <file path="src/components/Button.tsx" size="2.4 KB"> <![CDATA[import React from 'react'; export const Button = ({ label }) => { return <button className="px-4 py-2 bg-primary">{label}</button>; };]]> </file> <file path="src/components/NavBar.tsx" size="5.1 KB"> <![CDATA[import Link from 'next/link'; export function NavBar() { return ( <nav className="flex justify-between p-6 bg-surface"> <Link href="/">Home</Link> </nav> ); }]]> </file> <file path="src/lib/auth.ts" size="8.9 KB"> <![CDATA[import jwt from 'jsonwebtoken'; export const verifySession = (token: string) => { return jwt.verify(token, process.env.JWT_SECRET); };]]> </file> <file path="package.json" size="1.2 KB"> <![CDATA[{ "name": "siranta-app", "dependencies": { "framer-motion": "^11.0.0" } }]]> </file> </codebase>
✓ context.xml • 18.6 KB (Token-Efficient)LLM Ready

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.

The Old Way
script.ts
// 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.
The Kord Way
agent.ts
// 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.',
});
Core Architecture

How Kord Compiles Context

A high-speed context assembly engine written in Go, optimized for low overhead.

01

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.

Thread #1
walk src/components/
✓ Active
Thread #2
walk src/lib/auth.ts
✓ Active
Thread #3
skip node_modules/
✓ Idle
02

Priority Filters

Evaluates ignore parameters sequentially. Custom CLI patterns take precedence over local ignore config files.

1. CLI `--ignore` parametersOverride
2. Local `.sirantaignore`Inherit
3. Standard `.gitignore`Fallback
03

Binary Filter

Scans file header blocks (first 512 bytes) looking for null-bytes to safely identify and skip binary media, assets, or database weights.

0000: 00 4f 4b 01 5a 8f a1 fc
▲ NULL BYTE DETECTED -> SKIP
04

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.

<file path="src/main.go"> <![CDATA[package main; import "fmt";...]]> </file>
Interactive sandbox

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

compiled console
Compiled command script
$ kord . -o context.xml
Simulated builder console logs
Scanning files...
Found 1,247 workspace paths...
Applying exclusion filters...
✓ Successfully compiled to context.xml (XML)
STATUS: READY FOR INGESTION100% SECURE
CLI Manual

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: stdout

Writes the generated codebase context to a specific file target instead of printing it to stdout.

Example command
$ kord . -o context.xml
--helpalias: -htype: booleandefault: false

Displays detailed documentation, CLI syntax helpers, and descriptions of all arguments.

Example command
$ kord --help
--quietalias: -qtype: booleandefault: false

Suppresses logging output, warnings, and file processing progress reports. Useful for scripts.

Example command
$ kord . --quiet -o out.xml
LLM Attention Optimization

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.

Output XML Schema Map
<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>
Automated Reviews

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.

.github/workflows/ai-review.yml
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.

Recommended

Go Install

Requires Go 1.20 or later installed on your system.

go install github.com/siranta-ai/kord@latest
Alternative

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 .
code
Community & Contributions

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.