← Back to Skills Marketplace
jackkeller

Leanctx Integration

by Jack Keller · GitHub ↗ · v0.1.4 · MIT-0
cross-platform ✓ Security Clean
141
Downloads
2
Stars
0
Active Installs
5
Versions
Install in OpenClaw
/install leanctx-integration
Description
Automatically compresses OpenClaw tool outputs to reduce token usage by 60-99%
README (SKILL.md)

LeanContext Integration

LeanContext integration for OpenClaw that automatically compresses tool outputs to reduce token usage by 60-99%.

External Endpoints

Endpoint Data Sent Purpose
None N/A This skill operates entirely locally

No external API calls are made. All processing happens on your local machine.

Security & Privacy

  • Local-only operation: All compression and caching happens locally
  • No data leaves your machine: No files, commands, or content is sent to external services
  • Cache location: Stored in memory (optional filesystem cache can be configured)
  • No telemetry: No usage data, metrics, or analytics are transmitted

Model Invocation

This skill operates autonomously during OpenClaw's normal operation. It intercepts read and exec tool calls transparently without requiring explicit user approval for each invocation. This is standard behavior for OpenClaw skills.

To disable automatic invocation, set enabled: false in your OpenClaw config.

Trust Statement

By using this skill, your file contents and command outputs are processed locally for compression purposes. No data is sent to external services. Only install if you are comfortable with this local processing.

What it does

Intercepts OpenClaw's read and exec tool calls and applies intelligent compression:

  • File reads: AST-aware compression removes comments, whitespace, collapses function bodies
  • Shell exec: Pattern-matching compresses common commands (git, npm, docker, etc.)
  • Session caching: Re-reads cost ~13 tokens instead of thousands

Installation

openclaw skills install leanctx-integration

Or manually:

cd ~/.openclaw/workspace/skills
git clone https://github.com/your-repo/leanctx-integration.git
cd leanctx-integration
npm install
npm run build

Configuration

Add to your openclaw.json:

{
  "skills": {
    "leanctx-integration": {
      "enabled": true,
      "config": {
        "threshold": 100,
        "cacheEnabled": true,
        "excludedPaths": ["node_modules", ".git", "dist"],
        "excludedCommands": ["cat", "echo"]
      }
    }
  }
}

Usage

Once installed, LeanContext works automatically - no code changes required!

Check Metrics

Note: Metrics tracking has been temporarily disabled. The skill automatically compresses tool outputs, but session-level metrics reporting is not currently available. This feature may be revisited in a future update.

Clear Cache

Via your agent: Ask: "Clear the LeanCTX cache"

Direct CLI:

npx leanctx clear-cache

Compression Examples

TypeScript File (800 lines)

Before: ~2000 tokens
After: ~50 tokens
Savings: 97.5%

Git Log

Before: ~500 tokens (full commit info)
After: ~30 tokens (hashes + messages)
Savings: 94%

NPM Install

Before: ~200 tokens (all download messages)
After: ~10 tokens (summary only)
Savings: 95%

Supported Languages

  • TypeScript / JavaScript
  • Python
  • Svelte
  • Go
  • Rust
  • Java / Kotlin
  • Generic (fallback)

Supported Commands

  • git log → Commit hashes + first line
  • git status → Changed files only
  • git diff → Diff markers + changes
  • npm install → Package count
  • npm test → Test results + summary
  • cargo build → Errors only
  • docker ps → Header + first 10 rows
  • kubectl → Header + first 15 rows

Performance

  • Cache hit: \x3C5ms overhead
  • First read: ~10ms (AST parse)
  • Compression: 60-99% token reduction

Troubleshooting

Not working?

  1. Check if skill is enabled in config
  2. Verify threshold isn't too high
  3. Check excluded paths aren't matching

Want to disable for specific files?

Add to excludedPaths in config:

{
  "excludedPaths": ["node_modules", ".git", "**/*.spec.ts"]
}

Cache too large?

Ask your agent: "Clear the LeanCTX cache"

Or via CLI:

npx leanctx clear-cache

How it works

  1. OpenClaw makes a tool call (read or exec)
  2. LeanContext intercepts the call
  3. Checks cache (instant return if hit)
  4. Compresses based on file type or command pattern
  5. Caches result
  6. Returns compressed output to OpenClaw
  7. Metrics updated

License

MIT

Usage Guidance
This skill appears to do what it says: locally compress OpenClaw 'read' and 'exec' outputs. Before installing, review and consider the following: 1) The installer only prints the configuration block and does not automatically inject it into your openclaw.json — you must edit that file yourself; install.sh will back up the config if it reads it. 2) The package advertises a CLI (npx leanctx / bin/leanctx) that is not present in the repository — some advertised features (npx CLI, metrics CLI) may be incomplete. 3) Compression is AST/text-based and will remove comments/whitespace and collapse function bodies for summaries — confirm you are comfortable with this local transformation of file contents (it does not send data anywhere). 4) There are minor code bugs/typos (e.g., Svelte script matching uses HTML-escaped tags) that could affect behavior; consider testing in a safe environment first. If you rely on precise outputs for any tooling or auditing, test thoroughly and review src/index.ts to ensure the compression rules meet your needs.
Capability Analysis
Type: OpenClaw Skill Name: leanctx-integration Version: 0.1.4 The skill is a utility designed to reduce LLM token consumption by intercepting and compressing file read and command execution outputs. It uses local regex-based logic to strip comments and collapse code blocks in files like `src/index.ts`, and summarizes common shell outputs (e.g., git, npm). No evidence of data exfiltration, malicious execution, or hidden backdoors was found; the high-privilege interception of tool calls is clearly documented as its primary function.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
Name/description (compress tool outputs to reduce tokens) align with included source (src/index.ts) which implements wrapRead and wrapExec hooks, local caching, and compression strategies. Required artifacts and configuration are consistent with an OpenClaw hook. No unrelated credentials or binaries are requested.
Instruction Scope
SKILL.md instructs local interception of OpenClaw read/exec calls and editing openclaw.json to enable the hook; the source implements exactly this behavior. The SKILL.md explicitly declares 'local-only' operation and no external endpoints; the code contains no network calls and only uses local fs/crypto. Instructions do require editing OpenClaw config (expected for a hook).
Install Mechanism
No remote downloads or install spec in registry; there is an install.sh included which runs npm install in the skill directory. All dependencies referenced are standard (typescript, @types/node) and package-lock uses npm registry URLs. Small inconsistencies: package.json declares a bin entry ('leanctx') but no bin/leanctx file is present in the package; README/SKILL.md reference CLI usage (npx leanctx) that doesn't appear to be implemented. These are implementation issues but not indicators of malicious activity.
Credentials
Skill asks for no environment variables or external credentials. install.sh reads HOME and references the OpenClaw config file (~/.openclaw/openclaw.json) and creates a backup if the file exists — this is proportional to installing a local OpenClaw hook. No secrets/exfiltration mechanisms are present.
Persistence & Privilege
always:false (normal). The installer does not automatically modify system-wide settings — it prints instructions for adding the hook to openclaw.json and creates a local backup if the config is read. The skill does not try to modify other skills or global agent configuration programmatically.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install leanctx-integration
  3. After installation, invoke the skill by name or use /leanctx-integration
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.4
Remove metrics reporting - feature temporarily disabled pending session-level implementation
v0.1.3
Documentation update: agents must run CLI on behalf of users in chat channels
v0.1.2
Add CLI entry point for metrics access
v0.1.1
Added npm test script and updated version
v0.1.0
Initial release: Automatic tool output compression for OpenClaw
Metadata
Slug leanctx-integration
Version 0.1.4
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 5
Frequently Asked Questions

What is Leanctx Integration?

Automatically compresses OpenClaw tool outputs to reduce token usage by 60-99%. It is an AI Agent Skill for Claude Code / OpenClaw, with 141 downloads so far.

How do I install Leanctx Integration?

Run "/install leanctx-integration" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Leanctx Integration free?

Yes, Leanctx Integration is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Leanctx Integration support?

Leanctx Integration is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Leanctx Integration?

It is built and maintained by Jack Keller (@jackkeller); the current version is v0.1.4.

💬 Comments