home/productivity/prompt-collector-phase-a

Prompt Collector Phase a

GPTClaudeDeepSeek··518 copies·updated 2026-07-14
prompt-collector-phase-a.prompt
# Prompt Collector Phase A Implementation Plan

> **状态:已被新的 skill-first 方案取代。**
>
> 这份计划保留为早期菜单栏应用实现记录。当前有效计划见:
> `docs/superpowers/plans/2026-04-18-prompt-skill-runtime-v1.md`

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Build a local macOS menu bar app that imports historical prompts from Codex, Claude Code, Gemini CLI, and OpenCode, keeps syncing new prompts in the background, stores normalized records in SQLite, and exposes status plus repair hints from the menu bar.

**Architecture:** Use a SwiftPM-based macOS SwiftUI menu bar app with no third-party production dependencies. A source-adapter layer discovers and parses tool-specific local files into a shared prompt model, a SQLite-backed persistence layer stores normalized data plus checkpoints, and a collector engine coordinates full scans, incremental watches, analytics, and menu bar state.

**Tech Stack:** Swift 6, SwiftUI, AppKit, Observation, Foundation, SQLite3, XCTest, shell build/run bootstrap.

---

## File Structure

- `Package.swift`
  - Swift package definition, executable target, SQLite linkage, test target.
- `script/build_and_run.sh`
  - One-command kill/build/launch script for the macOS app bundle.
- `.codex/environments/environment.toml`
  - Codex desktop Run button wiring.
- `Sources/PromptCollectorApp/App/PromptCollectorApp.swift`
  - `@main` app entrypoint and menu bar scene.
- `Sources/PromptCollectorApp/App/AppState.swift`
  - App-wide observable state, startup orchestration, menu actions.
- `Sources/PromptCollectorApp/App/AppDelegate.swift`
  - App activation policy and lifecycle hooks needed for a menu bar app.
- `Sources/PromptCollectorApp/Models/DomainModels.swift`
  - Shared value types for tools, status, project, session, prompt, analytics.
- `Sources/PromptCollectorApp/Persistence/Database.swift`
  - SQLite connection management and migrations.
- `Sources/PromptCollectorApp/Persistence/PromptRepository.swift`
  - CRUD/query methods for statuses, prompts, sessions, projects, checkpoints, analytics reads.
- `Sources/PromptCollectorApp/Sources/SourceAdapter.swift`
  - Adapter protocol plus source root discovery contract.
- `Sources/PromptCollectorApp/Sources/CodexAdapter.swift`
  - Codex local source probing and prompt extraction.
- `Sources/PromptCollectorApp/Sources/ClaudeAdapter.swift`
  - Claude local source probing and prompt extraction.
- `Sources/PromptCollectorApp/Sources/GeminiAdapter.swift`
  - Gemini local source probing and prompt extraction.
- `Sources/PromptCollectorApp/Sources/OpenCodeAdapter.swift`
  - OpenCode local source probing and prompt extraction.
- `Sources/PromptCollectorApp/Services/CollectorEngine.swift`
  - Full scan, incremental import, dedupe, checkpoint updates.
- `Sources/PromptCollectorApp/Services/FileWatchService.swift`
  - Directory/file watch registration and event fanout.
- `Sources/PromptCollectorApp/Services/AnalyticsEngine.swift`
  - Derived facts and rule-based style metrics from normalized prompts.
- `Sources/PromptCollectorApp/Views/MenuBarContentView.swift`
  - Menu bar UI content: counts, source health, repair hints, actions.
- `Tests/PromptCollectorAppTests/Support/TestPaths.swift`
  - Temporary directory helpers and fixture loading.
- `Tests/PromptCollectorAppTests/Persistence/PromptRepositoryTests.swift`
  - Schema, insert/query, dedupe, checkpoint tests.
- `Tests/PromptCollectorAppTests/Sources/*AdapterTests.swift`
  - Fixture-driven prompt extraction tests per tool.
- `Tests/PromptCollectorAppTests/Services/CollectorEngineTests.swift`
  - Import orchestration and watch-trigger tests.
- `Tests/PromptCollectorAppTests/Services/AnalyticsEngineTests.swift`
  - Time distribution and style metric tests.
- `Tests/PromptCollectorAppTests/Fixtures/...`
  - Sanitized local-format samples for each source.

### Task 1: Bootstrap SwiftPM App Shell

**Files:**
- Create: `Package.swift`
- Create: `script/build_and_run.sh`
- Create: `.codex/environments/environment.toml`
- Create: `Sources/PromptCollectorApp/App/PromptCollectorApp.swift`
- Create: `Sources/PromptCollectorApp/App/AppState.swift`
- Create: `Sources/PromptCollectorApp/App/AppDelegate.swift`
- Create: `Sources/PromptCollectorApp/Views/MenuBarContentView.swift`
- Test: `Tests/PromptCollectorAppTests/App/AppBootTests.swift`

- [ ] **Step 1: Write the failing app bootstrap test**

when to use it

Community prompt sourced from the open-source GitHub repo piklen/briefsmith (MIT). A "Prompt Collector Phase a" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

piklen/briefsmith · MIT