Skip to content

Getting Started

Get up and running with codeknit in under 5 minutes.

You’ll need:

  • Go 1.26+
  • A C compiler (CGo is required for tree-sitter)
Terminal window
git clone https://github.com/awslabs/codeknit.git
cd codeknit
make build
# Binary is at ./bin/codeknit

Add the binary to your shell’s PATH:

Terminal window
# bash (~/.bashrc)
export PATH="$PATH:$(pwd)/bin"
# zsh (~/.zshrc)
export PATH="$PATH:$(pwd)/bin"
# fish (~/.config/fish/config.fish)
fish_add_path $(pwd)/bin

Reload your shell or run source ~/.bashrc (or ~/.zshrc) for the change to take effect.

Check that codeknit is working:

Terminal window
codeknit --version

Run your first parse on a codebase:

Terminal window
codeknit parse ./myproject

This command:

  • Parses all source files in ./myproject
  • Extracts structural information (functions, classes, relationships)
  • Writes chunked .skt files to ./skeleton/ (default output directory)

If you re-run this command, use --clean to remove previous output:

Terminal window
codeknit parse ./myproject --clean

The .skt files contain structured code information. Here’s a small example:

[symbols]
## src/main.go
S1 module/package L1-L1 main {}
S2 type/struct L5-L8 Server {exported}
S3 callable/function L10-L12 NewServer(addr: string) -> *S2 {exported}
S4 callable/method L14-L19 Start() {receiver=*Server}
[edges]
S2 --contains--> S4
S3 --returns--> S2

Key sections:

  • [symbols]: Definitions grouped by file, showing name, line span, and metadata
  • [edges]: Relationships like contains, calls, inherits, or returns

Now that you’ve run your first parse: