Tools
Little Coder
Little Coder extensions as native OpenClaw plugin
Configuration Example
{
"plugins": {
"entries": {
"little-coder": {
"enabled": true,
"config": {
"qualityMonitorEnabled": true,
"correctionMax": 2,
"turnCapEnabled": false,
"turnMax": 50,
"writeGuardEnabled": true,
"skillInjectionEnabled": true,
"skillTokenBudget": 150,
"skillsDir": "~/.openclaw/workspace/skills/tools"
},
"hooks": {
"allowConversationAccess": true
}
}
},
"allow": ["little-coder"]
}
}
README
# Little Coder โ OpenClaw Plugin
Port of Little Coder extensions (Evidence, ShellSession, Write Guard, Skill Injection) as a native OpenClaw plugin.
[](https://github.com/openclaw/little-coder/actions/workflows/build.yml)
[](LICENSE)
## Features
### Tools (6)
| Tool | Description |
|------|-------------|
| `EvidenceAdd` | Add a citable piece of evidence/fact to the knowledge base |
| `EvidenceGet` | Retrieve evidence by ID |
| `EvidenceList` | List all stored evidence |
| `ShellSession` | Execute a command in a persistent shell session |
| `ShellCwd` | Get or set the current working directory of the shell session |
| `ShellReset` | Reset all persistent shell sessions |
### Hooks (5)
| Hook | Priority | Purpose |
|------|----------|---------|
| `before_tool_call` | 200 | Turn cap enforcement |
| `before_tool_call` | 100 | Tool tracking + WriteGuard |
| `after_tool_call` | 50 | Track tool usage for skill injection |
| `agent_end` | 10 | Quality monitoring (convergence detection) |
| `before_prompt_build` | 1 | Skill/context injection |
## Installation
### 1. Clone the plugin
```bash
git clone https://github.com/openclaw/little-coder.git
cd little-coder
```
### 2. Install dependencies
```bash
npm ci
```
### 3. Build
```bash
npm run build
```
### 4. Deploy to OpenClaw
Copy the built plugin to your OpenClaw extensions directory:
```bash
cp dist/index.js ~/.openclaw/extensions/little-coder/index.js
```
### 5. Configure OpenClaw
Add the plugin entry to `~/.openclaw/openclaw.json`:
```json
{
"plugins": {
"entries": {
"little-coder": {
"enabled": true,
"config": {
"qualityMonitorEnabled": true,
"correctionMax": 2,
"turnCapEnabled": false,
"turnMax": 50,
"writeGuardEnabled": true,
"skillInjectionEnabled": true,
"skillTokenBudget": 150,
"skillsDir": "~/.openclaw/workspace/skills/tools"
},
"hooks": {
"allowConversationAccess": true
}
}
},
"allow": ["little-coder"]
}
}
```
Restart the Gateway after adding the plugin.
## Configuration
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `qualityMonitorEnabled` | `boolean` | `true` | Enable convergence detection and auto-correction |
| `correctionMax` | `integer` | `2` | Maximum quality corrections per session |
| `turnCapEnabled` | `boolean` | `false` | Enable turn count limit |
| `turnMax` | `integer` | `50` | Maximum turns per agent run |
| `writeGuardEnabled` | `boolean` | `true` | Enable path normalization for Write tool |
| `skillInjectionEnabled` | `boolean` | `true` | Enable skill card injection |
| `skillTokenBudget` | `integer` | `150` | Token budget for skill content injection |
| `skillsDir` | `string` | `~/.openclaw/workspace/skills/tools` | Directory for skill Markdown files |
## Usage Examples
### Evidence tools
```typescript
// Add evidence
api.call("EvidenceAdd", {
content: "The quick brown fox jumps over the lazy dog",
source: "wikipedia.org/article"
});
// Get specific evidence
api.call("EvidenceGet", { id: "ev_1234567890_0" });
// List all evidence
api.call("EvidenceList");
```
### Shell session
```typescript
// Execute a command
api.call("ShellSession", {
command: "ls -la /home",
cwd: "/home"
});
// Change working directory
api.call("ShellCwd", { path: "/tmp" });
// Reset all shell sessions
api.call("ShellReset");
```
## Architecture
### Module organization
```
little-coder/
โโโ src/
โ โโโ index.ts # Plugin entry point
โ โโโ hooks/
โ โ โโโ quality-monitor.ts # Convergence detection & correction
โ โ โโโ skill-inject.ts # Skill card injection
โ โ โโโ turn-cap.ts # Turn count limiting
โ โ โโโ write-guard.ts # Path normalization
โ โโโ tools/
โ โโโ evidence.ts # Evidence knowledge base tools
โ โโโ shell.ts # Persistent shell tools
โโโ dist/
โ โโโ index.js # Single-file bundle (compiled)
โโโ .github/workflows/
โ โโโ build.yml # CI: npm build + lint
โโโ package.json
โโโ tsconfig.json
โโโ README.md
```
### API patterns
**Hooks** use `api.on(name, handler, opts)`:
```typescript
api.on(
"before_tool_call",
async (event) => {
const ctx = event.context || {};
// inspect ctx.toolName, ctx.params
},
{ priority: 100 }
);
```
**Tools** use `api.registerTool({ name, label, description, parameters, execute })`:
```typescript
api.registerTool({
name: "MyTool",
label: "MyTool",
description: "Does something",
parameters: Type.Object({ /* schema */ }),
execute: async (toolCallId, params, signal, onUpdate) => {
return { ok: true, result: "done" };
}
});
```
### OpenClaw internals
This plugin extends OpenClaw's internal plugin API:
- **Plugin SDK**: `openclaw/plugin-sdk/plugin-entry`
- **Tool types**: `typebox` for schema validation
- **Hook system**: Internal `api.on()` for lifecycle hooks
- **Session API**: `api.session.workflow.enqueueNextTurnInjection()` for quality corrections
## License
MIT
tools
Comments
Sign in to leave a comment