From 80b2e1cc36e8c6b27ade7af0f8946f403a8166fb Mon Sep 17 00:00:00 2001 From: Andy Pai Date: Fri, 20 Mar 2026 18:36:56 -0400 Subject: [PATCH 1/9] feat: add activity log command --- README.md | 51 +++++- SKILL.md | 114 ++++++++++--- specs/001-log-command/tasks.md | 157 ++++++++++++++++++ src/commands/activity-log.test.ts | 150 +++++++++++++++++ src/commands/activity-log.ts | 192 ++++++++++++++++++++++ src/commands/activity-show.ts | 24 +-- src/commands/activity.ts | 1 + src/commands/formatters.ts | 20 ++- src/commands/index.ts | 3 +- src/commands/types.ts | 5 + src/session/index.ts | 3 + src/session/time-bucketing.test.ts | 256 +++++++++++++++++++++++++++++ src/session/time-bucketing.ts | 149 +++++++++++++++++ src/session/types.ts | 9 + src/utils/time.ts | 4 +- src/wildcard.ts | 15 ++ 16 files changed, 1111 insertions(+), 42 deletions(-) create mode 100644 specs/001-log-command/tasks.md create mode 100644 src/commands/activity-log.test.ts create mode 100644 src/commands/activity-log.ts create mode 100644 src/session/time-bucketing.test.ts create mode 100644 src/session/time-bucketing.ts diff --git a/README.md b/README.md index 41b694e..fc481e8 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,13 @@ The built-in `watch` pipeline captures file changes as `edit` events. The event Status: early alpha. Expect breaking changes while the data model and UX settle. +For implementation details, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). For the operator-focused reporting workflow used by AI agents, see [SKILL.md](SKILL.md). + ## Requirements - Bun 1.3.8 - macOS or Linux (Windows is not supported; use WSL2 if needed) -- Optional: Ollama or OpenAI-compatible API for AI summaries +- Optional: Ollama, OpenAI, or Gemini for AI summaries ## Install / Run From Source @@ -36,21 +38,29 @@ wildcard watch --roots ~/Projects --daemon # Show today's sessions wildcard show today +# Show chronological activity log (today by default) +wildcard log +wildcard log week + # Generate a weekly report wildcard report week +# Push pending local data to a central ingest server +wildcard sync push + # Search the timeline wildcard search "config" --from 2025-01-01 --to 2025-01-31 --types edit,ocr # Check daemon status wildcard status +wildcard status --json # macOS: install/uninstall launchd service wildcard install-launchd --roots ~/Projects wildcard uninstall-launchd wildcard restart -# Prune cached summaries +# Prune old local data wildcard prune --older-than 30 ``` @@ -71,13 +81,17 @@ Event types: Useful flags: -- `show` / `report`: `--force-refresh` to bypass summary cache +- `show`, `log`, `report`, `search`: `--device ` to filter multi-device data +- `report`: `--force-refresh` to bypass summary cache - `report`: `--no-ai` to force heuristic summaries +- `report`: `--no-progress` to keep stdout clean for piping or file capture +- `log`: `--json` for machine-readable output +- `status`: `--json` for machine-readable output - `watch`: `--memlog`, `--mem-warn-mb`, `--mem-limit-mb` for memory logging/guards ## Configuration -Default config path: `~/.wildcard/config.yaml`. Data lives under `~/.wildcard/` by default. +Default config path: `~/.wildcard/config.yaml`. Data lives under `~/.wildcard/` by default. Defaults come from `src/config/config-store.ts`; the example below shows the most relevant fields rather than every compatibility knob. ```yaml store_dir: ~/.wildcard @@ -98,14 +112,26 @@ watch: checkpoint_interval_s: 60 session: - idle_threshold_s: 20 - activity_window_s: 20 + idle_threshold_s: 300 + activity_window_s: 120 ai: enabled: false provider: ollama model: llama3.2 base_url: http://localhost:11434 + +identity: + device_id: laptop + +sync: + enabled: false + server_url: http://localhost:3000 + batch_size: 500 + max_payload_bytes: 2097152 + interval_s: 300 + max_retries: 8 + batch_delay_ms: 0 ``` Environment variables: @@ -118,8 +144,19 @@ Environment variables: - `WILDCARD_AI_MODEL` - `WILDCARD_AI_BASE_URL` - `WILDCARD_AI_API_KEY` (fallbacks: `OPENAI_API_KEY` for OpenAI, `GEMINI_API_KEY` for Gemini) +- `WILDCARD_DEVICE_ID` +- `WILDCARD_SYNC_ENABLED` +- `WILDCARD_SYNC_SERVER_URL` +- `WILDCARD_SYNC_API_KEY` +- `WILDCARD_SYNC_BATCH_SIZE` +- `WILDCARD_SYNC_MAX_PAYLOAD_BYTES` +- `WILDCARD_SYNC_INTERVAL_S` +- `WILDCARD_SYNC_MAX_RETRIES` +- `WILDCARD_SYNC_BATCH_DELAY_MS` - `WILDCARD_DEBUG_OSASCRIPT` (`1` to log frontmost-app AppleScript stderr/debug details) +AI summary prompt templates live in `src/summary/prompts/*.md`. The markdown files hold the stable system instructions, while runtime session/project data is still assembled in code. + ## Data Locations - `~/.wildcard/timeline.db` (SQLite timeline) @@ -152,7 +189,7 @@ bun run sync-shutdown-test ## Security and Privacy -Wildcard stores activity data locally by default. If you enable AI providers, data may be sent to those services depending on your config. Review `SECURITY.md` for reporting vulnerabilities. +Wildcard stores activity data locally by default. If you enable AI providers or remote sync, data may be sent to those services depending on your config. Review [SECURITY.md](SECURITY.md) for reporting vulnerabilities. ## License diff --git a/SKILL.md b/SKILL.md index 92791e6..9881f13 100644 --- a/SKILL.md +++ b/SKILL.md @@ -10,16 +10,19 @@ Wildcard is a local-first CLI that captures file activity into a SQLite timeline The tool is designed for personal developer workflows: start a watcher, work normally, then review what you did with `show`, `report`, or `search`. +For general installation and operator-facing usage, see [README.md](README.md). For implementation details and source-of-truth architecture notes, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). + ## When to Use This Skill Use this skill when the user wants to: - **Start watching** file activity (`watch`) - **Check daemon status** (`status`) -- **View sessions** for a time period (`show`) +- **View sessions** for a time period (`show`, `log`) - **Generate reports** with optional AI summaries (`report`) - **Search the timeline** for past activity (`search`) - **Configure** wildcard (config.yaml, env vars) +- **Push local data upstream** (`sync push`) - **Manage the macOS daemon** (install/uninstall launchd, restart) - **Maintain data** (prune old data, archive to another DB) - **Troubleshoot** issues (daemon not running, stale PID, AI not working) @@ -85,6 +88,28 @@ wildcard show week The period can also be passed as a flag: `wildcard show --today`, `--yesterday`, or `--week`. +### log — View chronological activity log + +Display activity broken down by time slot — hourly for today/yesterday, daily for week. + +```bash +wildcard log +wildcard log today +wildcard log yesterday +wildcard log week +``` + +The period can also be passed as a flag: `wildcard log --today`, `--yesterday`, or `--week`. + +**Difference from `show`**: `log` is time-first (each time slot lists the projects active in it), while `show` is project-first (each project shows its total time). Use `log` to answer "what was I doing at 2pm?"; use `show` to answer "how much time did I spend on each project?" + +**Flags:** + +| Flag | Description | +| ---------------- | --------------------------------------- | +| `--device ` | Filter by device ID(s), comma-separated | +| `--json` | Output machine-readable JSON | + ### report — Generate summary reports Generate heuristic or AI-powered reports for a time period. @@ -109,10 +134,12 @@ wildcard report yesterday --no-progress **Flags:** -| Flag | Description | -| ----------------- | ----------------------------------- | -| `--no-ai` | Force heuristic summaries | -| `--force-refresh` | Bypass summary cache and regenerate | +| Flag | Description | +| ----------------- | --------------------------------------- | +| `--no-ai` | Force heuristic summaries | +| `--force-refresh` | Bypass summary cache and regenerate | +| `--device ` | Filter by device ID(s), comma-separated | +| `--no-progress` | Disable progress output on stderr | ## Context-Enriched Reporting Workflow @@ -171,6 +198,7 @@ Use this structure for each major project in enriched reports: ```md ### -