agentleFS
Hacck3yHacck3y/ptk/.github/copilot-instructions.md

ptk

Copilot instructions2 starsChanged 3 months agoApache-2.0View on GitHub

ptk is a CLI proxy that filters and compresses command outputs before they reach an LLM context, cutting 60-90% of bash output. It wraps common tools (git, cargo, grep, pnpm, go, etc.) and outputs condensed summaries instead of raw output. Percentages measure bash output, not billed tokens; PTK ships no tokenizer (src/core/tracking.rs estimates bytes / 4). Always prefix commands with ptk when running shell commands — this reduces token consumption for every operation you perform. ptk meta-commands (always use these…

The file

We split this copilot-instructions.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Regex: Use LazyLock<Regex> for fixed patterns reused across calls.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 3,827 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions for ptk

ptk is a CLI proxy that filters and compresses command outputs before they reach an LLM context, cutting 60-90% of bash output. It wraps common tools (git, cargo, grep, pnpm, go, etc.) and outputs condensed summaries instead of raw output. Percentages measure bash output, not billed tokens; PTK ships no tokenizer (src/core/tracking.rs estimates bytes / 4).

Using ptk in this session

Always prefix commands with ptk when running shell commands — this reduces token consumption for every operation you perform.

# Instead of:              Use:
git status                 ptk git status
git log -10                ptk git log -10
cargo test                 ptk cargo test
cargo clippy --all-targets ptk cargo clippy --all-targets
grep -r "pattern" src/     ptk grep -r "pattern" src/

ptk meta-commands (always use these directly, no prefix needed):

ptk gain              # Show token savings analytics
ptk gain --history    # Full command history with per-command savings
ptk discover          # Scan session history for missed ptk opportunities
ptk proxy <cmd>       # Run a command raw (no filtering) but still track it

Verify ptk is installed before starting:

ptk --version   # Should print: ptk X.Y.Z
ptk gain        # Should show a dashboard (not "command not found")

Name collision: ptk gain failing means you have reachingforthejack/rtk (Rust Type Kit) installed instead. Run which ptk to check.

Build, Test & Lint

cargo build                    # Development build
cargo test                     # All tests
cargo test test_name           # Single test
cargo test module::tests::     # Module tests
cargo test -- --nocapture      # With stdout

# Pre-commit gate (must all pass before any PR)
cargo fmt --all --check && cargo clippy --all-targets && cargo test

bash scripts/test-all.sh       # Smoke tests (requires installed binary)

PRs target the develop branch, not main. All commits require a DCO sign-off (git commit -s).

Architecture

ptk routes CLI commands via a Clap Commands enum in main.rs to specialized filter modules in src/cmds/*/, each executing the underlying command and compressing output. Token savings are tracked in SQLite via src/core/tracking.rs.

For full details see ARCHITECTURE.md and docs/contributing/TECHNICAL.md. Module responsibilities are documented in each folder's README.md and each file's //! doc header.

Key Conventions

  • Error handling: anyhow::Result with .context("description")? — no bare ?, no unwrap() in production. Filters must fall back to raw command on error.
  • Regex: Use LazyLock<Regex> for fixed patterns reused across calls; keep runtime-dependent patterns local.
  • Testing: Unit tests inside modules (#[cfg(test)] mod tests). Fixtures in tests/fixtures/. Token savings assertions with count_tokens().
  • Exit codes: Preserve the underlying command's exit code via std::process::exit(code).
  • Performance: Startup <10ms (no async runtime), binary <5MB stripped.
  • Branch naming: fix(scope):, feat(scope):, chore(scope): where scope is the affected component.

For the full contribution workflow, design philosophy, and new-filter checklist, see CONTRIBUTING.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.