Skip to content

tunguz/claw-code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claw Code

Claw Code is a Fortran-first CLI for exploring a mirrored workspace catalog. It ships a native binary that can inspect archived command, tool, and subsystem inventories, route prompts to likely matches, emit setup/bootstrap reports, and persist lightweight session transcripts.

This repository is not the original TypeScript implementation. The archived command and tool surfaces are mirrored as metadata catalogs inside the Fortran codebase. Commands such as exec-command and exec-tool report what would handle a prompt or payload; they do not run the archived TypeScript sources.

What You Can Do With It

  • Inspect the current Fortran port surface with summary and manifest
  • Search mirrored commands and tools with commands and tools
  • Route a free-form prompt to likely command/tool matches with route
  • Simulate a bootstrap/runtime pass with bootstrap or turn-loop
  • Persist and reload simple session transcripts with flush-transcript and load-session
  • Inspect setup, bootstrap, and inventory diagnostics with setup-report, parity-audit, command-graph, tool-pool, and bootstrap-graph

Prerequisites

The checked-in Makefile assumes a macOS-style toolchain:

  • gfortran in PATH
  • make
  • Xcode Command Line Tools or another environment that provides xcrun

On macOS, installing Homebrew GCC is typically enough to provide gfortran.

Quick Start

Build the CLI:

make

Run a few representative commands:

./build/claw-code summary
./build/claw-code commands --query review --limit 10
./build/claw-code tools --query MCP --limit 10
./build/claw-code route "review MCP tool" --limit 5
./build/claw-code bootstrap "review MCP tool" --limit 5

Run the test suite:

make test

If you just want the command list, run the binary with no arguments:

./build/claw-code

Repository Layout

.
├── Makefile                   # Root build/test entrypoint
├── app/
│   └── claw_code.f90          # Program entrypoint
├── src/
│   ├── claw_app.f90           # CLI dispatch, reports, routing, bootstrap flow
│   ├── claw_command_data.f90  # Mirrored command inventory
│   ├── claw_tool_data.f90     # Mirrored tool inventory
│   ├── claw_subsystem_data.f90
│   ├── claw_session.f90       # Session persistence under .port_sessions/
│   ├── claw_shell.f90         # Shell capture helpers for tests/runtime output
│   ├── claw_strings.f90       # String matching and escaping helpers
│   ├── claw_types.f90         # Shared derived types
│   ├── claw_workspace.f90     # Repo scanning, counts, root detection
│   └── reference_data/        # Tracked snapshot inputs behind the mirrored catalogs
├── tests/
│   └── claw_code_test.f90     # Fortran-native test executable
├── assets/                    # Project assets
└── .port_sessions/            # Generated session files

Build, Test, Clean

Build the main binary:

make

Binary output:

build/claw-code

Run the Fortran-native test executable:

make test

Remove build outputs, module files, and stored sessions:

make clean

Using the CLI

1. Inspect the port itself

Use these commands to understand the current Fortran surface:

./build/claw-code summary
./build/claw-code manifest
./build/claw-code subsystems --limit 10
  • summary prints a concise view of the Fortran modules plus command/tool surface counts
  • manifest prints the full top-level Fortran module list
  • subsystems prints archived subsystem metadata; use --limit N to control output size

2. Search mirrored commands and tools

Use these commands to search the archived inventories:

./build/claw-code commands --query review --limit 10
./build/claw-code commands --query auth --no-plugin-commands
./build/claw-code tools --query MCP --limit 10
./build/claw-code tools --simple-mode --no-mcp

Supported filters:

  • commands
    • --query TEXT
    • --limit N
    • --no-plugin-commands
    • --no-skill-commands
  • tools
    • --query TEXT
    • --limit N
    • --simple-mode
    • --no-mcp

3. Route prompts and inspect matches

Use the routing and lookup commands when you already have a prompt or a specific item name:

./build/claw-code route "review MCP tool" --limit 5
./build/claw-code show-command review
./build/claw-code show-tool MCPTool
./build/claw-code exec-command review "inspect security review"
./build/claw-code exec-tool MCPTool "fetch resource list"
  • route scores and prints the best mirrored command/tool matches for a prompt
  • show-command and show-tool print the name, archived source hint, and responsibility text
  • exec-command and exec-tool simulate which mirrored item would handle the input

4. Simulate runtime/bootstrap flows

These commands produce richer output that combines routing, setup details, and synthetic execution traces:

./build/claw-code setup-report
./build/claw-code bootstrap-graph
./build/claw-code bootstrap "review MCP tool" --limit 5
./build/claw-code turn-loop "review MCP tool" --max-turns 2 --structured-output
  • setup-report prints compiler, platform, trusted-mode, and deferred-init information
  • bootstrap-graph prints the high-level startup pipeline
  • bootstrap renders a full runtime session, including context, routed matches, stream events, and persisted session path
  • turn-loop emits repeated turn results; use --max-turns N and --structured-output as needed

5. Persist and reload sessions

Session files are stored under .port_sessions/.

Create a transcript:

./build/claw-code flush-transcript "review MCP tool"

Typical output:

.port_sessions/20260331-190509-1176816493.session
flushed=True

Reload that session by id:

./build/claw-code load-session 20260331-190509-1176816493

Typical output:

20260331-190509-1176816493
1 messages
in=3 out=10

6. Diagnostics and mode reports

Additional commands:

./build/claw-code parity-audit
./build/claw-code command-graph
./build/claw-code tool-pool --simple-mode --no-mcp
./build/claw-code remote-mode workspace
./build/claw-code ssh-mode workspace
./build/claw-code teleport-mode workspace
./build/claw-code direct-connect-mode workspace
./build/claw-code deep-link-mode workspace
  • parity-audit compares against the local archive when archive/claude_code_ts_snapshot/src exists
  • command-graph summarizes builtin/plugin-like/skill-like command counts
  • tool-pool prints a filtered tool inventory view
  • mode commands print placeholder connection/mode state for the requested target

Tests

The repository uses a native Fortran test executable at tests/claw_code_test.f90. The suite covers:

  • string helper behavior
  • workspace root and source/test counting
  • subsystem lookup behavior
  • session roundtripping
  • CLI smoke coverage for the supported command surface

Run everything with:

make test

Notes for Maintainers

  • The primary entrypoint is app/claw_code.f90
  • Most CLI behavior lives in src/claw_app.f90
  • Mirrored inventory data is checked in through the Fortran data modules in src/
  • Snapshot/reference inputs live under src/reference_data/
  • Session files are local artifacts and can be cleared with make clean

About

Better Harness Tools, not merely storing the archive of leaked Claude Code but also make real things done. Now rewriting in Fortran.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Fortran 99.5%
  • Makefile 0.5%