UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

156 lines (109 loc) • 5.1 kB
--- name: phren-discover description: Audit the phren memory store and report what needs attention, such as stale content, projects missing a summary and skill gaps, with the top three things to fix. dependencies: - git - gh --- # phren-discover - Phren health check Use `add_finding` for decisions, current policies and workarounds. Pin a truth only when the owner explicitly asks to remember it permanently, such as “pin this” or “always do this from now on” as a standing rule. > Audit your phren repo and tell you exactly what needs attention. Scans your phren directory for missing files, stale content and skill gaps. Outputs a concrete, prioritized action list. **Works standalone.** Just needs a phren directory. ## When to run - Weekly or monthly maintenance - When you feel like things are getting messy - Before starting a new project (to see what you've been neglecting) - When the user asks "what should I work on" ## What to do ### 1. Find the phren directory ```bash PHREN_DIR="${PHREN_DIR:-$HOME/.phren}" ls "$PHREN_DIR" 2>/dev/null ``` If it doesn't exist: > "No phren directory found at ~/.phren. Run `phren-init` to set one up." ### 2. Scan all projects For each project directory in `$PHREN_DIR/*/` (skip `global/`, `profiles/`): ```bash for dir in "$PHREN_DIR"/*/; do PROJECT=$(basename "$dir") [ "$PROJECT" = "global" ] || [ "$PROJECT" = "profiles" ] && continue [ -f "$dir/AGENTS.md" ] && echo "$PROJECT: has AGENTS.md" || echo "$PROJECT: MISSING AGENTS.md" [ -f "$dir/summary.md" ] && echo "$PROJECT: has summary.md" || echo "$PROJECT: MISSING summary.md" [ -f "$dir/FINDINGS.md" ] && echo "$PROJECT: has FINDINGS.md" || echo "$PROJECT: MISSING FINDINGS.md" done ``` ### 3. Check staleness For projects that are in a git-tracked phren, check when files were last modified: ```bash cd "$PHREN_DIR" for dir in */; do PROJECT=$(basename "$dir") [ "$PROJECT" = "global" ] || [ "$PROJECT" = "profiles" ] && continue if [ -f "$dir/FINDINGS.md" ]; then LAST_MODIFIED=$(git log -1 --format="%cr" -- "$dir/FINDINGS.md" 2>/dev/null || stat -c %Y "$dir/FINDINGS.md" 2>/dev/null || stat -f %m "$dir/FINDINGS.md" 2>/dev/null) echo "$PROJECT/FINDINGS.md: last updated $LAST_MODIFIED" fi if [ -f "$dir/AGENTS.md" ]; then LAST_MODIFIED=$(git log -1 --format="%cr" -- "$dir/AGENTS.md" 2>/dev/null || stat -c %Y "$dir/AGENTS.md" 2>/dev/null || stat -f %m "$dir/AGENTS.md" 2>/dev/null) echo "$PROJECT/AGENTS.md: last updated $LAST_MODIFIED" fi done ``` Flag anything not updated in 30+ days as stale. ### 4. Detect skill gaps Look at patterns in FINDINGS.md files across projects. A skill gap is when: - Multiple projects repeat the same manual process (e.g., "remember to update the changelog," which should be a skill) - A FINDINGS.md entry says "next time, do X first," which is a skill waiting to happen Also check global/skills/ to see what skills exist, and whether any project's workflow isn't covered. ### 5. Scaffold missing summary.md files For each project with a missing summary.md, output the template and offer to create it: ``` Project: myapp MISSING: summary.md Template: ``` # myapp What: Stack: Status: active Run: Watch out: ``` Want me to fill this in for myapp? ``` If yes, gather the 5 fields from the user and write the file to `$PHREN_DIR/myapp/summary.md`. ### 6. Output the report ``` phren-discover ## Section 1: Missing files Projects without core files: | Project | AGENTS.md | summary.md | FINDINGS.md | |---------|-----------|------------|-------------| | myapp | ok | MISSING | MISSING | | api | ok | ok | ok | ## Section 2: Stale content Files not updated in 30+ days: - my-app/FINDINGS.md: last updated 45 days ago - frontend/AGENTS.md: last updated 62 days ago ## Section 3: Skill gaps Things you do repeatedly that could be skills: - my-app FINDINGS.md mentions "always run parity check" 4 times. Already have `/parity`, but it's not in the workflow skill. ## Top 3 things to work on next 1. **Add FINDINGS.md to myapp.** You've been working on it actively but capturing nothing. Use `add_finding()` during your next session. 2. **Create a `/changelog` skill.** You're doing it manually in 3 projects. 15 minutes to write the skill saves hours over time. ``` The "Top 3" section is the most important part. Make these: - Concrete (not "improve documentation" but "add FINDINGS.md to myapp") - Prioritized (highest impact first) - Actionable (someone could start right now) ## What not to do - Don't flag missing files in projects that are archived or inactive - Don't recommend creating files just for completeness; only flag what would actually help - Don't be vague in the Top 3. Every item should be a clear next action. - Don't pad the report with things that are fine. Focus on what needs attention. ## Related skills - `phren-init`: scaffold missing files for a project - `add_finding()`: capture findings via MCP (fixes "missing FINDINGS.md") - `phren-consolidate`: synthesize cross-project patterns