clawck 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +322 -0
- package/dist/cli/index.d.ts +14 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +233 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/clawck.d.ts +48 -0
- package/dist/core/clawck.d.ts.map +1 -0
- package/dist/core/clawck.js +119 -0
- package/dist/core/clawck.js.map +1 -0
- package/dist/core/database.d.ts +55 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +329 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +23 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/sync.d.ts +17 -0
- package/dist/core/sync.d.ts.map +1 -0
- package/dist/core/sync.js +91 -0
- package/dist/core/sync.js.map +1 -0
- package/dist/core/types.d.ts +186 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +34 -0
- package/dist/core/types.js.map +1 -0
- package/dist/dashboard/index.d.ts +6 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +632 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/server/api.d.ts +15 -0
- package/dist/server/api.d.ts.map +1 -0
- package/dist/server/api.js +193 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/mcp.d.ts +8 -0
- package/dist/server/mcp.d.ts.map +1 -0
- package/dist/server/mcp.js +277 -0
- package/dist/server/mcp.js.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vince Quarles / CubiCrew
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# ⏱️🦀 Clawck
|
|
2
|
+
|
|
3
|
+
**Time tracking for AI agents. Toggl for the agentic era.**
|
|
4
|
+
|
|
5
|
+
Clawck is an open-source tool that tracks how long AI agents spend on tasks, projects, and client work — then shows you how much human-equivalent time and money they saved.
|
|
6
|
+
|
|
7
|
+
Every service business runs on timesheets. AI agent businesses will too.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why Clawck?
|
|
12
|
+
|
|
13
|
+
AI agents are doing real work — writing code, researching grants, generating content, analyzing data. But nobody's tracking *how long* that work takes or *how much value* it delivers.
|
|
14
|
+
|
|
15
|
+
Clawck answers the questions your clients, managers, and finance teams are already asking:
|
|
16
|
+
|
|
17
|
+
- **"What did the AI actually do today?"** → A clear timesheet showing every task, duration, and outcome
|
|
18
|
+
- **"Is this worth what we're paying?"** → Human-equivalent hours and cost savings calculated automatically
|
|
19
|
+
- **"Which agent is the most productive?"** → Per-agent breakdowns across projects and clients
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install
|
|
25
|
+
npm install -g clawck
|
|
26
|
+
|
|
27
|
+
# Initialize
|
|
28
|
+
clawck init
|
|
29
|
+
|
|
30
|
+
# Seed with sample data (to see the dashboard)
|
|
31
|
+
clawck seed --count 30
|
|
32
|
+
|
|
33
|
+
# Start the server + dashboard
|
|
34
|
+
clawck serve
|
|
35
|
+
# → Dashboard at http://localhost:3456
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## How It Works
|
|
39
|
+
|
|
40
|
+
### 1. Agents clock in and out
|
|
41
|
+
|
|
42
|
+
**Via MCP (Claude Code, Cline, Cursor, Windsurf):**
|
|
43
|
+
|
|
44
|
+
Add to your MCP config (`~/.claude/mcp_servers.json` or similar):
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"clawck": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "clawck", "mcp"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Now your agent has access to:
|
|
56
|
+
- `clawck_start_task` — Start a timer
|
|
57
|
+
- `clawck_stop_task` — Stop a timer
|
|
58
|
+
- `clawck_log_task` — Log a completed task retroactively
|
|
59
|
+
- `clawck_status` — See what's running
|
|
60
|
+
- `clawck_timesheet` — Get a summary report
|
|
61
|
+
|
|
62
|
+
**Via REST API:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Start a task
|
|
66
|
+
curl -X POST http://localhost:3456/api/start \
|
|
67
|
+
-H "Content-Type: application/json" \
|
|
68
|
+
-d '{"task": "Research grant opportunities", "project": "grant-research", "client": "acme-corp", "category": "research", "agent": "cubi-research-01"}'
|
|
69
|
+
|
|
70
|
+
# Stop a task
|
|
71
|
+
curl -X POST http://localhost:3456/api/stop \
|
|
72
|
+
-H "Content-Type: application/json" \
|
|
73
|
+
-d '{"id": "entry-uuid-here", "status": "completed", "summary": "Found 12 matching grants", "tokens_in": 15000, "tokens_out": 3000}'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Via the SDK (in your own code):**
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Clawck } from 'clawck';
|
|
80
|
+
|
|
81
|
+
const clawck = new Clawck({
|
|
82
|
+
default_client: 'acme-corp',
|
|
83
|
+
default_agent: 'my-agent',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const entry = clawck.start({
|
|
87
|
+
task: 'Analyze Q3 customer data',
|
|
88
|
+
project: 'analytics',
|
|
89
|
+
category: 'analysis',
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// ... agent does work ...
|
|
93
|
+
|
|
94
|
+
clawck.stop({
|
|
95
|
+
id: entry.id,
|
|
96
|
+
status: 'completed',
|
|
97
|
+
tokens_in: 25000,
|
|
98
|
+
tokens_out: 8000,
|
|
99
|
+
cost_usd: 0.12,
|
|
100
|
+
summary: 'Identified 3 key churn drivers',
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 2. Clawck calculates human-equivalent value
|
|
105
|
+
|
|
106
|
+
Every entry has a **category** (research, content, code, data_entry, design, etc.) and Clawck applies configurable multipliers to estimate how long a human would take:
|
|
107
|
+
|
|
108
|
+
| Category | Agent → Human Multiplier | Human Rate |
|
|
109
|
+
|----------|--------------------------|------------|
|
|
110
|
+
| Research | 12x | $50/hr |
|
|
111
|
+
| Content | 10x | $45/hr |
|
|
112
|
+
| Code | 6x | $75/hr |
|
|
113
|
+
| Data Entry | 20x | $25/hr |
|
|
114
|
+
| Design | 5x | $60/hr |
|
|
115
|
+
| Analysis | 10x | $55/hr |
|
|
116
|
+
| Testing | 8x | $65/hr |
|
|
117
|
+
|
|
118
|
+
So if an agent spends 30 minutes on research, Clawck reports it as **6 hours of human-equivalent work** and **$300 in estimated value**.
|
|
119
|
+
|
|
120
|
+
### 3. View the dashboard
|
|
121
|
+
|
|
122
|
+
Open `http://localhost:3456` to see:
|
|
123
|
+
|
|
124
|
+
- 📊 **Stats cards** — Agent hours, human-equiv hours, cost, active tasks
|
|
125
|
+
- 💚 **Savings banner** — Total estimated value delivered
|
|
126
|
+
- 📋 **Time entries** — Every task with duration, category, and status
|
|
127
|
+
- 📁 **By Project** — Hours breakdown per project with visual bars
|
|
128
|
+
- 🤖 **By Agent** — Per-agent productivity and success rates
|
|
129
|
+
- 🏷️ **By Category** — Where time is going across work types
|
|
130
|
+
|
|
131
|
+
## Multi-Agent Aggregation
|
|
132
|
+
|
|
133
|
+
Running 10 agents across multiple machines? Clawck merges them:
|
|
134
|
+
|
|
135
|
+
**Option A: Central collector pulls from remote instances**
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
# .clawck/config.json
|
|
139
|
+
{
|
|
140
|
+
"remote_sources": [
|
|
141
|
+
{ "name": "research-agent", "url": "http://cubi-01:3456/api/entries" },
|
|
142
|
+
{ "name": "writer-agent", "url": "http://cubi-02:3456/api/entries" },
|
|
143
|
+
{ "name": "coder-agent", "url": "http://cubi-03:3456/api/entries" }
|
|
144
|
+
],
|
|
145
|
+
"sync_interval": 60
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Option B: Agents push to a central instance**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# From any agent, POST entries to central Clawck
|
|
153
|
+
curl -X POST http://central-clawck:3456/api/ingest \
|
|
154
|
+
-H "Content-Type: application/json" \
|
|
155
|
+
-d '[{"task": "...", "agent": "cubi-01", ...}]'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Entries merge cleanly by UUID — no conflicts, no duplicates.
|
|
159
|
+
|
|
160
|
+
## CLI Commands
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
clawck init # Create .clawck/ directory with config
|
|
164
|
+
clawck serve # Start API + dashboard (default: port 3456)
|
|
165
|
+
clawck serve --port 8080 # Custom port
|
|
166
|
+
clawck mcp # Start MCP server on stdio
|
|
167
|
+
clawck status # Show running tasks and stats
|
|
168
|
+
clawck report # Timesheet summary (last 7 days)
|
|
169
|
+
clawck report --days 30 # Last 30 days
|
|
170
|
+
clawck report --client acme # Filter by client
|
|
171
|
+
clawck seed --count 50 # Generate test data
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Configuration
|
|
175
|
+
|
|
176
|
+
Edit `.clawck/config.json`:
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"port": 3456,
|
|
181
|
+
"default_client": "acme-corp",
|
|
182
|
+
"default_project": "general",
|
|
183
|
+
"default_agent": "cubi-01",
|
|
184
|
+
"default_model": "claude-sonnet-4-20250514",
|
|
185
|
+
"human_equivalents": {
|
|
186
|
+
"research": { "multiplier": 12, "human_rate_usd": 50 },
|
|
187
|
+
"content": { "multiplier": 10, "human_rate_usd": 45 },
|
|
188
|
+
"code": { "multiplier": 6, "human_rate_usd": 75 },
|
|
189
|
+
"data_entry": { "multiplier": 20, "human_rate_usd": 25 },
|
|
190
|
+
"design": { "multiplier": 5, "human_rate_usd": 60 },
|
|
191
|
+
"analysis": { "multiplier": 10, "human_rate_usd": 55 },
|
|
192
|
+
"testing": { "multiplier": 8, "human_rate_usd": 65 },
|
|
193
|
+
"planning": { "multiplier": 6, "human_rate_usd": 50 },
|
|
194
|
+
"communication": { "multiplier": 8, "human_rate_usd": 40 },
|
|
195
|
+
"other": { "multiplier": 8, "human_rate_usd": 50 }
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## REST API
|
|
201
|
+
|
|
202
|
+
| Method | Endpoint | Description |
|
|
203
|
+
|--------|----------|-------------|
|
|
204
|
+
| `POST` | `/api/start` | Start tracking a task |
|
|
205
|
+
| `POST` | `/api/stop` | Stop a running task |
|
|
206
|
+
| `POST` | `/api/log` | Log a completed task retroactively |
|
|
207
|
+
| `PATCH` | `/api/entries/:id` | Update an entry |
|
|
208
|
+
| `GET` | `/api/entries` | Query entries (with filters) |
|
|
209
|
+
| `GET` | `/api/entries/:id` | Get a single entry |
|
|
210
|
+
| `GET` | `/api/running` | Get currently running tasks |
|
|
211
|
+
| `GET` | `/api/timesheet` | Get timesheet summary |
|
|
212
|
+
| `GET` | `/api/clients` | List all clients |
|
|
213
|
+
| `GET` | `/api/projects` | List all projects |
|
|
214
|
+
| `GET` | `/api/agents` | List all agents |
|
|
215
|
+
| `POST` | `/api/ingest` | Bulk import entries |
|
|
216
|
+
| `GET` | `/api/health` | Health check |
|
|
217
|
+
| `GET` | `/api/stats` | Quick stats |
|
|
218
|
+
|
|
219
|
+
## Architecture
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
clawck/
|
|
223
|
+
src/
|
|
224
|
+
core/ → Schema, database (SQLite), entry manager
|
|
225
|
+
server/ → REST API (Express) + MCP server (stdio)
|
|
226
|
+
dashboard/ → Single-file HTML dashboard
|
|
227
|
+
cli/ → Command-line interface
|
|
228
|
+
adapters/ → Framework integrations (future)
|
|
229
|
+
.clawck/
|
|
230
|
+
config.json → Your configuration
|
|
231
|
+
clawck.db → SQLite database (auto-created)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Design principles:**
|
|
235
|
+
- **Zero external dependencies** — SQLite is embedded, no Redis/Postgres/Docker needed
|
|
236
|
+
- **One process** — API, dashboard, and MCP all run from the same `clawck serve`
|
|
237
|
+
- **Append-only writes** — Entries are created and updated, never deleted
|
|
238
|
+
- **UUID-based merging** — Multi-agent data combines without conflicts
|
|
239
|
+
- **Configurable multipliers** — Human-equivalent estimates are transparent and adjustable
|
|
240
|
+
|
|
241
|
+
## ClawckSpec v0.1
|
|
242
|
+
|
|
243
|
+
Clawck implements an open schema for agent work entries. Any tool can emit ClawckSpec-compatible entries:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
248
|
+
"agent": "cubi-research-01",
|
|
249
|
+
"model": "claude-sonnet-4-20250514",
|
|
250
|
+
"client": "acme-corp",
|
|
251
|
+
"project": "grant-research",
|
|
252
|
+
"task": "Find NEA grants matching sustainability criteria",
|
|
253
|
+
"category": "research",
|
|
254
|
+
"start": "2026-03-07T10:00:00Z",
|
|
255
|
+
"end": "2026-03-07T10:47:00Z",
|
|
256
|
+
"status": "completed",
|
|
257
|
+
"tokens_in": 12400,
|
|
258
|
+
"tokens_out": 3200,
|
|
259
|
+
"cost_usd": 0.0852,
|
|
260
|
+
"tool_calls": 8,
|
|
261
|
+
"summary": "Found 12 matching grants totaling $2.4M in available funding",
|
|
262
|
+
"tags": ["grants", "sustainability"],
|
|
263
|
+
"source": "clawck-mcp",
|
|
264
|
+
"spec_version": "0.1.0"
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Integrations
|
|
269
|
+
|
|
270
|
+
### Claude Code
|
|
271
|
+
Add to `~/.claude/mcp_servers.json`:
|
|
272
|
+
```json
|
|
273
|
+
{ "clawck": { "command": "npx", "args": ["-y", "clawck", "mcp"] } }
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### OpenClaw
|
|
277
|
+
Instrument at the harness level — auto-start/stop entries on task dispatch.
|
|
278
|
+
|
|
279
|
+
### n8n
|
|
280
|
+
POST to `/api/start` and `/api/stop` from HTTP Request nodes.
|
|
281
|
+
|
|
282
|
+
### LangGraph / CrewAI / Any Python Framework
|
|
283
|
+
```python
|
|
284
|
+
import requests
|
|
285
|
+
|
|
286
|
+
# Start
|
|
287
|
+
r = requests.post("http://localhost:3456/api/start", json={
|
|
288
|
+
"task": "Analyze data", "project": "analytics", "agent": "my-agent"
|
|
289
|
+
})
|
|
290
|
+
entry_id = r.json()["id"]
|
|
291
|
+
|
|
292
|
+
# Stop
|
|
293
|
+
requests.post("http://localhost:3456/api/stop", json={
|
|
294
|
+
"id": entry_id, "status": "completed"
|
|
295
|
+
})
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Roadmap
|
|
299
|
+
|
|
300
|
+
- [ ] Python SDK (`pip install clawck`)
|
|
301
|
+
- [ ] Auto-instrumentation (monkey-patch LLM client libraries)
|
|
302
|
+
- [ ] PDF report export
|
|
303
|
+
- [ ] Email digest (weekly summary to clients)
|
|
304
|
+
- [ ] Webhooks (notify on task completion)
|
|
305
|
+
- [ ] Claude Code hooks adapter
|
|
306
|
+
- [ ] OpenTelemetry exporter
|
|
307
|
+
- [ ] "Powered by Clawck" embeddable widget
|
|
308
|
+
|
|
309
|
+
## Contributing
|
|
310
|
+
|
|
311
|
+
Contributions welcome! Especially:
|
|
312
|
+
- **Adapters** — New framework integrations
|
|
313
|
+
- **Dashboard** — UI improvements and features
|
|
314
|
+
- **Multipliers** — Better human-equivalent estimates backed by data
|
|
315
|
+
|
|
316
|
+
## License
|
|
317
|
+
|
|
318
|
+
MIT — use it, fork it, build on it.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
Built by [CubiCrew](https://cubicrew.com) · Created by [Vince Quarles](https://github.com/vincequarles)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ⏱️🦀 Clawck — CLI
|
|
4
|
+
* Command-line interface for managing AI agent time tracking.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* clawck init Create .clawck/ directory
|
|
8
|
+
* clawck serve Start API server + dashboard
|
|
9
|
+
* clawck mcp Start MCP server (stdio)
|
|
10
|
+
* clawck status Show running tasks and stats
|
|
11
|
+
* clawck report [--days N] Show timesheet summary
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* ⏱️🦀 Clawck — CLI
|
|
5
|
+
* Command-line interface for managing AI agent time tracking.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* clawck init Create .clawck/ directory
|
|
9
|
+
* clawck serve Start API server + dashboard
|
|
10
|
+
* clawck mcp Start MCP server (stdio)
|
|
11
|
+
* clawck status Show running tasks and stats
|
|
12
|
+
* clawck report [--days N] Show timesheet summary
|
|
13
|
+
*/
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const commander_1 = require("commander");
|
|
19
|
+
const path_1 = __importDefault(require("path"));
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const api_1 = require("../server/api");
|
|
22
|
+
const mcp_1 = require("../server/mcp");
|
|
23
|
+
const clawck_1 = require("../core/clawck");
|
|
24
|
+
const types_1 = require("../core/types");
|
|
25
|
+
const program = new commander_1.Command();
|
|
26
|
+
program
|
|
27
|
+
.name('clawck')
|
|
28
|
+
.description('⏱️🦀 Clawck — Time tracking for AI agents')
|
|
29
|
+
.version('0.1.0');
|
|
30
|
+
// ─── Init ─────────────────────────────────────────────────
|
|
31
|
+
program
|
|
32
|
+
.command('init')
|
|
33
|
+
.description('Initialize a .clawck/ directory in the current folder')
|
|
34
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
35
|
+
.action(async (opts) => {
|
|
36
|
+
const dir = path_1.default.resolve(opts.dir);
|
|
37
|
+
if (!fs_1.default.existsSync(dir)) {
|
|
38
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
const configPath = path_1.default.join(dir, 'config.json');
|
|
41
|
+
if (!fs_1.default.existsSync(configPath)) {
|
|
42
|
+
const config = {
|
|
43
|
+
port: 3456,
|
|
44
|
+
default_client: '',
|
|
45
|
+
default_project: '',
|
|
46
|
+
default_agent: '',
|
|
47
|
+
default_model: '',
|
|
48
|
+
default_source: 'clawck',
|
|
49
|
+
human_equivalents: types_1.DEFAULT_HUMAN_EQUIVALENTS,
|
|
50
|
+
remote_sources: [],
|
|
51
|
+
};
|
|
52
|
+
fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
53
|
+
}
|
|
54
|
+
console.log(`\n ⏱️🦀 Clawck initialized!`);
|
|
55
|
+
console.log(` ├─ Data dir: ${dir}`);
|
|
56
|
+
console.log(` ├─ Config: ${configPath}`);
|
|
57
|
+
console.log(` ├─ Database: ${path_1.default.join(dir, 'clawck.db')} (created on first run)`);
|
|
58
|
+
console.log(` │`);
|
|
59
|
+
console.log(` │ Next steps:`);
|
|
60
|
+
console.log(` │ 1. Edit ${configPath} with your defaults`);
|
|
61
|
+
console.log(` │ 2. Run: clawck serve`);
|
|
62
|
+
console.log(` │ 3. Open: http://localhost:3456`);
|
|
63
|
+
console.log(` └─ Done!\n`);
|
|
64
|
+
});
|
|
65
|
+
// ─── Serve ────────────────────────────────────────────────
|
|
66
|
+
program
|
|
67
|
+
.command('serve')
|
|
68
|
+
.description('Start the Clawck API server and dashboard')
|
|
69
|
+
.option('-p, --port <number>', 'Port number', '3456')
|
|
70
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
71
|
+
.action(async (opts) => {
|
|
72
|
+
const config = loadConfig(opts.dir);
|
|
73
|
+
config.port = parseInt(opts.port) || config.port;
|
|
74
|
+
(0, api_1.startServer)(config);
|
|
75
|
+
});
|
|
76
|
+
// ─── MCP ──────────────────────────────────────────────────
|
|
77
|
+
program
|
|
78
|
+
.command('mcp')
|
|
79
|
+
.description('Start the Clawck MCP server (stdio, for Claude Code / Cline / Cursor)')
|
|
80
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
81
|
+
.action(async (opts) => {
|
|
82
|
+
const config = loadConfig(opts.dir);
|
|
83
|
+
(0, mcp_1.startMCPServer)(config);
|
|
84
|
+
});
|
|
85
|
+
// ─── Status ───────────────────────────────────────────────
|
|
86
|
+
program
|
|
87
|
+
.command('status')
|
|
88
|
+
.description('Show currently running tasks and stats')
|
|
89
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
90
|
+
.action(async (opts) => {
|
|
91
|
+
const config = loadConfig(opts.dir);
|
|
92
|
+
const clawck = await new clawck_1.Clawck(config).ready();
|
|
93
|
+
const stats = clawck.stats();
|
|
94
|
+
const running = clawck.running();
|
|
95
|
+
console.log(`\n ⏱️🦀 Clawck Status`);
|
|
96
|
+
console.log(` ├─ Total entries: ${stats.total_entries}`);
|
|
97
|
+
console.log(` ├─ Running now: ${stats.running}`);
|
|
98
|
+
console.log(` ├─ Clients: ${stats.clients}`);
|
|
99
|
+
console.log(` ├─ Projects: ${stats.projects}`);
|
|
100
|
+
console.log(` └─ Agents: ${stats.agents}`);
|
|
101
|
+
if (running.length > 0) {
|
|
102
|
+
console.log(`\n ⏱️ Running Tasks:`);
|
|
103
|
+
for (const e of running) {
|
|
104
|
+
const mins = Math.round((Date.now() - new Date(e.start).getTime()) / 60000);
|
|
105
|
+
console.log(` ├─ ${e.task}`);
|
|
106
|
+
console.log(` │ ${e.agent} → ${e.project}/${e.client} (${mins}m)`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
console.log('');
|
|
110
|
+
clawck.close();
|
|
111
|
+
});
|
|
112
|
+
// ─── Report ───────────────────────────────────────────────
|
|
113
|
+
program
|
|
114
|
+
.command('report')
|
|
115
|
+
.description('Show a timesheet summary')
|
|
116
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
117
|
+
.option('--days <number>', 'Number of days to include', '7')
|
|
118
|
+
.option('--client <name>', 'Filter by client')
|
|
119
|
+
.option('--project <name>', 'Filter by project')
|
|
120
|
+
.option('--agent <name>', 'Filter by agent')
|
|
121
|
+
.action(async (opts) => {
|
|
122
|
+
const config = loadConfig(opts.dir);
|
|
123
|
+
const clawck = await new clawck_1.Clawck(config).ready();
|
|
124
|
+
const days = parseInt(opts.days) || 7;
|
|
125
|
+
const to = new Date().toISOString();
|
|
126
|
+
const from = new Date(Date.now() - days * 86400000).toISOString();
|
|
127
|
+
const ts = clawck.timesheet(from, to, {
|
|
128
|
+
client: opts.client,
|
|
129
|
+
project: opts.project,
|
|
130
|
+
agent: opts.agent,
|
|
131
|
+
});
|
|
132
|
+
console.log(`\n 📋 Clawck Timesheet — Last ${days} days`);
|
|
133
|
+
console.log(` ${'─'.repeat(50)}`);
|
|
134
|
+
console.log(` ⏱️ Agent hours: ${ts.total_agent_hours.toFixed(1)} hrs`);
|
|
135
|
+
console.log(` 👤 Human equiv: ${ts.total_human_equiv_hours.toFixed(1)} hrs`);
|
|
136
|
+
console.log(` 💰 Agent cost: $${ts.total_cost_usd.toFixed(2)}`);
|
|
137
|
+
console.log(` 💚 Est. savings: $${ts.total_savings_usd.toFixed(0)}`);
|
|
138
|
+
console.log(` 🔢 Total entries: ${ts.total_entries}`);
|
|
139
|
+
console.log(` 🪙 Total tokens: ${ts.total_tokens.toLocaleString()}`);
|
|
140
|
+
if (ts.by_project.length > 0) {
|
|
141
|
+
console.log(`\n 📁 By Project:`);
|
|
142
|
+
for (const p of ts.by_project) {
|
|
143
|
+
const bar = '█'.repeat(Math.max(1, Math.round(p.agent_hours / (ts.total_agent_hours || 1) * 20)));
|
|
144
|
+
console.log(` ${bar} ${p.project} (${p.client}): ${p.agent_hours.toFixed(1)}h → ${p.human_equiv_hours.toFixed(1)}h human equiv`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (ts.by_agent.length > 0) {
|
|
148
|
+
console.log(`\n 🤖 By Agent:`);
|
|
149
|
+
for (const a of ts.by_agent) {
|
|
150
|
+
console.log(` • ${a.agent} (${a.model}): ${a.agent_hours.toFixed(1)}h, ${a.success_rate}% success`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
console.log('');
|
|
154
|
+
clawck.close();
|
|
155
|
+
});
|
|
156
|
+
// ─── Seed (for testing) ──────────────────────────────────
|
|
157
|
+
program
|
|
158
|
+
.command('seed')
|
|
159
|
+
.description('Seed the database with sample entries (for testing)')
|
|
160
|
+
.option('-d, --dir <path>', 'Data directory', '.clawck')
|
|
161
|
+
.option('-n, --count <number>', 'Number of entries', '25')
|
|
162
|
+
.action(async (opts) => {
|
|
163
|
+
const config = loadConfig(opts.dir);
|
|
164
|
+
const clawck = await new clawck_1.Clawck(config).ready();
|
|
165
|
+
const count = parseInt(opts.count) || 25;
|
|
166
|
+
const agents = ['cubi-research-01', 'cubi-writer-02', 'cubi-coder-03', 'cubi-analyst-04', 'cubi-outreach-05'];
|
|
167
|
+
const models = ['claude-sonnet-4-20250514', 'claude-haiku-4-5-20251001', 'gpt-4o', 'gemini-2.0-flash'];
|
|
168
|
+
const clients = ['acme-corp', 'globex-inc', 'initech', 'hooli'];
|
|
169
|
+
const projects = ['website-rebuild', 'seo-content', 'grant-research', 'data-migration', 'email-campaigns'];
|
|
170
|
+
const categories = ['research', 'content', 'code', 'data_entry', 'analysis', 'communication', 'testing', 'design'];
|
|
171
|
+
const tasks = [
|
|
172
|
+
'Research competitor pricing strategies',
|
|
173
|
+
'Write blog post about AI automation',
|
|
174
|
+
'Refactor authentication module',
|
|
175
|
+
'Migrate legacy CSV data to new schema',
|
|
176
|
+
'Analyze Q3 customer churn patterns',
|
|
177
|
+
'Draft outreach emails for partnership',
|
|
178
|
+
'Write unit tests for payment flow',
|
|
179
|
+
'Design email template for newsletter',
|
|
180
|
+
'Find relevant grant opportunities',
|
|
181
|
+
'Compile industry benchmark report',
|
|
182
|
+
'Update API documentation',
|
|
183
|
+
'Generate social media content calendar',
|
|
184
|
+
'Review and optimize database queries',
|
|
185
|
+
'Create investor pitch deck outline',
|
|
186
|
+
'Summarize recent industry news',
|
|
187
|
+
];
|
|
188
|
+
for (let i = 0; i < count; i++) {
|
|
189
|
+
const daysAgo = Math.random() * 14;
|
|
190
|
+
const durationMin = 5 + Math.random() * 120;
|
|
191
|
+
const tokensIn = Math.round(1000 + Math.random() * 50000);
|
|
192
|
+
const tokensOut = Math.round(500 + Math.random() * 20000);
|
|
193
|
+
const category = categories[Math.floor(Math.random() * categories.length)];
|
|
194
|
+
clawck.log({
|
|
195
|
+
task: tasks[Math.floor(Math.random() * tasks.length)],
|
|
196
|
+
project: projects[Math.floor(Math.random() * projects.length)],
|
|
197
|
+
client: clients[Math.floor(Math.random() * clients.length)],
|
|
198
|
+
category,
|
|
199
|
+
agent: agents[Math.floor(Math.random() * agents.length)],
|
|
200
|
+
model: models[Math.floor(Math.random() * models.length)],
|
|
201
|
+
duration_minutes: Math.round(durationMin),
|
|
202
|
+
tokens_in: tokensIn,
|
|
203
|
+
tokens_out: tokensOut,
|
|
204
|
+
cost_usd: Math.round((tokensIn * 0.000003 + tokensOut * 0.000015) * 10000) / 10000,
|
|
205
|
+
summary: 'Auto-generated seed entry for testing',
|
|
206
|
+
tags: ['seed', 'test'],
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
console.log(`\n ⏱️🦀 Seeded ${count} entries into Clawck!`);
|
|
210
|
+
console.log(` └─ Run: clawck serve\n`);
|
|
211
|
+
clawck.close();
|
|
212
|
+
});
|
|
213
|
+
// ─── Helpers ──────────────────────────────────────────────
|
|
214
|
+
function loadConfig(dir) {
|
|
215
|
+
const dataDir = path_1.default.resolve(dir);
|
|
216
|
+
const configPath = path_1.default.join(dataDir, 'config.json');
|
|
217
|
+
let fileConfig = {};
|
|
218
|
+
if (fs_1.default.existsSync(configPath)) {
|
|
219
|
+
try {
|
|
220
|
+
fileConfig = JSON.parse(fs_1.default.readFileSync(configPath, 'utf-8'));
|
|
221
|
+
}
|
|
222
|
+
catch (e) {
|
|
223
|
+
// Ignore bad config
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
...types_1.DEFAULT_CONFIG,
|
|
228
|
+
...fileConfig,
|
|
229
|
+
data_dir: dataDir,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
program.parse();
|
|
233
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;GAUG;;;;;AAEH,yCAAoC;AACpC,gDAAwB;AACxB,4CAAoB;AACpB,uCAA4C;AAC5C,uCAA+C;AAC/C,2CAAwC;AACxC,yCAAwF;AAExF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,2CAA2C,CAAC;KACxD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,6DAA6D;AAE7D,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,CAAC;KACvD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,YAAE,CAAC,SAAS,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E,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,oBAAoB;QACtB,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,sBAAc;QACjB,GAAG,UAAU;QACb,QAAQ,EAAE,OAAO;KAClB,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ⏱️🦀 Clawck — Entry Manager
|
|
3
|
+
* High-level API for managing agent time entries.
|
|
4
|
+
*/
|
|
5
|
+
import { ClawckEntry, ClawckConfig, ClawckStartInput, ClawckStopInput, ClawckLogInput, TimesheetSummary } from './types';
|
|
6
|
+
import { ClawckDB } from './database';
|
|
7
|
+
export declare class Clawck {
|
|
8
|
+
private _db;
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config?: Partial<ClawckConfig>);
|
|
11
|
+
/** Wait for the database to be ready (call once before first operation) */
|
|
12
|
+
ready(): Promise<this>;
|
|
13
|
+
get database(): ClawckDB;
|
|
14
|
+
upsert(entry: ClawckEntry): ClawckEntry;
|
|
15
|
+
start(input: ClawckStartInput): ClawckEntry;
|
|
16
|
+
stop(input: ClawckStopInput): ClawckEntry | null;
|
|
17
|
+
log(input: ClawckLogInput): ClawckEntry;
|
|
18
|
+
update(id: string, updates: Partial<ClawckEntry>): ClawckEntry | null;
|
|
19
|
+
get(id: string): ClawckEntry | null;
|
|
20
|
+
running(): ClawckEntry[];
|
|
21
|
+
query(filters?: {
|
|
22
|
+
client?: string;
|
|
23
|
+
project?: string;
|
|
24
|
+
agent?: string;
|
|
25
|
+
category?: string;
|
|
26
|
+
status?: string;
|
|
27
|
+
from?: string;
|
|
28
|
+
to?: string;
|
|
29
|
+
limit?: number;
|
|
30
|
+
}): ClawckEntry[];
|
|
31
|
+
timesheet(from: string, to: string, filters?: {
|
|
32
|
+
client?: string;
|
|
33
|
+
project?: string;
|
|
34
|
+
agent?: string;
|
|
35
|
+
}): TimesheetSummary;
|
|
36
|
+
clients(): string[];
|
|
37
|
+
projects(): string[];
|
|
38
|
+
agents(): string[];
|
|
39
|
+
stats(): {
|
|
40
|
+
total_entries: number;
|
|
41
|
+
running: number;
|
|
42
|
+
clients: number;
|
|
43
|
+
projects: number;
|
|
44
|
+
agents: number;
|
|
45
|
+
};
|
|
46
|
+
close(): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=clawck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clawck.d.ts","sourceRoot":"","sources":["../../src/core/clawck.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAC/D,gBAAgB,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,MAAM;IACjB,OAAO,CAAC,GAAG,CAAW;IACtB,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAK9C,2EAA2E;IACrE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,IAAI,QAAQ,IAAI,QAAQ,CAAqB;IAI7C,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAMvC,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW;IA2B3C,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI;IAchD,GAAG,CAAC,KAAK,EAAE,cAAc,GAAG,WAAW;IA8BvC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,GAAG,IAAI;IAMrE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAInC,OAAO,IAAI,WAAW,EAAE;IAIxB,KAAK,CAAC,OAAO,GAAE;QACb,MAAM,CAAC,EAA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