- Removed priority lines from various TODO markdown files - Added new admin.md for grokkit admin tool - Updated README.md with new entry
73 lines
2.4 KiB
Markdown
73 lines
2.4 KiB
Markdown
# `grokkit agent` cnotes integration
|
|
|
|
**Description**: Wrappers for your `cnotes` CLI logging suite. Allows Grok to automatically log coding sessions, notes, progress during agent workflows (e.g., "start work on feature", "log bug found").
|
|
|
|
## Problem It Solves
|
|
|
|
Developers track time/effort manually. Integrate `cnotes` (cnadd/cndump/etc.) for AI-assisted logging: timestamps, descriptions, stats—seamless with code edits.
|
|
|
|
## Benefits
|
|
|
|
- **Automated logging**: Grok logs at key points (start/edit/commit).
|
|
- **Queryable**: Search/dump stats via AI ("Show time on agent tasks today").
|
|
- **Safe**: Append-only (`cnadd`), read-only queries (`cnfind`/`cncount`); no deletes.
|
|
- **Terminal-native**: Fast C impl, no deps.
|
|
- **Workflow boost**: "Refactor → log changes → stats".
|
|
|
|
## Agent Tool Examples
|
|
|
|
```
|
|
grokkit agent "Start logging session, fix main.go, log completion"
|
|
# Grok: cnadd "start: agent refactor main.go" → edits → cnadd "done: fixed errors"
|
|
```
|
|
|
|
```
|
|
grokkit agent "Log today's coding stats before planning"
|
|
# Grok: cncount → cnfind "today" → "2h on edits, 3 sessions"
|
|
```
|
|
|
|
## High-Level Implementation
|
|
|
|
1. **Detect cnotes**: Run `cnhelp` or `which cnotes`.
|
|
2. **Tool schemas**:
|
|
- `log_note(message: string) → ok`
|
|
- `list_notes(filter?: string) → string`
|
|
- `session_stats() → string`
|
|
3. **Wrappers** in `internal/tools/cnotes.go`:
|
|
```go
|
|
func LogNote(ctx context.Context, args map[string]any) (string, error)
|
|
```
|
|
4. **Agent integration**: Auto-log on milestones; user-prompted.
|
|
5. **Safety**:
|
|
- Only `cnadd`/`cndump`/`cnfind`/`cncount`.
|
|
- Preview log message.
|
|
- Config: `[tools.cnotes.enabled]`.
|
|
6. **Parsing**: Stdout JSON? Or simple text.
|
|
|
|
## Flags / Config
|
|
|
|
| Key | Description |
|
|
|-----|-------------|
|
|
| `tools.cnotes.enabled` | Enable cnotes tools |
|
|
| `--auto-log` | Log start/end automatically |
|
|
|
|
## Implementation Notes
|
|
|
|
- **Commands**: cnadd (log), cndump (all), cnfind (search), cncount (stats), cndel (archive—whitelist carefully).
|
|
- **Extend agent**: Tool calls in loop.
|
|
- **Errors**: Custom CnotesError.
|
|
- **Tests**: Mock `exec.Command`, table-driven.
|
|
- **Effort**: Low (~150 LOC). Simple exec wrappers.
|
|
- **Prereq**: cnotes in PATH (`cnhelp` verifies).
|
|
|
|
## ROI
|
|
|
|
**High**. Personal logging elevates from code tool to **dev productivity hub**:
|
|
|
|
| Stage | Covered |
|
|
|-------|---------|
|
|
| Logging | **cnotes** ← new |
|
|
| Code | `agent` ✓ |
|
|
| Repo | tea (sibling) |
|
|
|
|
Quantifiable: Track hours/features automatically. |