Promptfolio Summarize

TotalClaw 作者 billc8128 v0.1.0

分析 Claude Code、Cursor、Codex、ChatGPT、Gemini CLI、Trae、OpenCode、Antigravity、Windsurf、OpenClaw 和其他编码代理的 AI 对话历史记录,以查找框架句子(用户教 AI 如何思考的时刻)并构建一个揭示此人是谁的肖像。

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:billc8128~promptfolio-summarize
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Abillc8128~promptfolio-summarize/file -o promptfolio-summarize.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/6673eb6f8559fe15f21e924ffa87e02d03b419e5
# promptfolio-summarize

You are building a **portrait of the human user** — the person running this command is the subject being analyzed. Their portrait will be displayed on the **promptfolio** platform. You are not summarizing projects, not evaluating AI usage skills, not writing a performance review. You are finding the moments where this person teaches AI how to think — their **framework sentences** — and using those to paint a picture of who they are.

To do this, analyze their AI conversation history (Claude Code, Cursor, Codex, ChatGPT, Gemini CLI, Trae, OpenCode, Antigravity, Windsurf, OpenClaw and any other coding agents found on the system) from the **last 30 days**, extract an **activity heat map** and **framework sentences** that reveal this person's thinking, then build a portrait around those sentences.

**Fundamental principle: find where the user is TEACHING, not where they are COMMANDING.** "Fix this bug" tells you nothing. "Don't think about it that way — this isn't a performance problem, it's a user psychology problem" / "你不要这样想,这不是性能问题,是用户心理问题" tells you everything.

## Step 0: Auto-Update

Before anything else, run the auto-updater to ensure you have the latest skill files and data formats:

```bash
bash ~/.promptfolio/update-check.sh
```

- If output is `UPDATED v...` → tell the user: **"Skills updated to v{version}."** Then **re-read this SKILL.md file** since it may have changed, and continue from Step 1.
- If output is `UP_TO_DATE v...` → continue silently.
- If output is `OFFLINE v...` → tell the user: **"Could not check for updates (offline). Running with local v{version}."** Continue normally.

Then continue with Step 1 normally.

## Step 1: Authentication

Ensure `~/.promptfolio/config.json` exists and has a valid token.

### 1a. Validate existing token (if config exists):
```bash
if [ -f ~/.promptfolio/config.json ]; then
  API_TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.promptfolio/config.json'))['api_token'])")
  API_URL=$(python3 -c "import json; print(json.load(open('$HOME/.promptfolio/config.json')).get('api_url','https://promptfolio.club'))")
  HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $API_TOKEN" "$API_URL/api/profile/me" || true)
  echo "HTTP_CODE=$HTTP_CODE"
fi
```
- If HTTP 200, proceed to Step 2.
- If config missing or HTTP is not 200, run the device auth script:

### 1b. Run device authorization:
```bash
bash "SKILL_DIR/../scripts/device-auth.sh"
```
Replace `SKILL_DIR` with the directory containing this SKILL.md file. The script handles everything: requesting a device code, opening the browser, polling until authorized, and saving `~/.promptfolio/config.json`.

**IMPORTANT:** You MUST run the script as-is. Do NOT reimplement the auth flow yourself. Do NOT construct auth URLs manually — let the script handle everything.

If the script fails, tell the user authorization timed out and to try again.

## Step 2: Discover Sessions

**Before running any commands, tell the user:**

> All conversation analysis happens locally on your machine. No raw conversation content is sent to any server during analysis. Only structured results are uploaded after your explicit confirmation.

### 2a. Detect installed tools

Before scanning, check which AI coding tools the user actually has installed. Look for their config/data directories:

| Tool | How to detect |
|------|---------------|
| Claude Code | `~/.claude/projects/` exists |
| Cursor | `~/.cursor/projects/` exists |
| Codex | `~/.codex/` exists |
| OpenClaw | `~/.openclaw/` exists |
| Gemini CLI | `~/.gemini/tmp/` exists (with `chats/` subdirs) |
| Antigravity | `~/Library/Application Support/Antigravity/` or `~/.gemini/antigravity/` exists |
| Windsurf | `~/.codeium/windsurf/`, `~/.windsurf/`, or `~/Library/Application Support/Windsurf/` exists |
| ChatGPT | `~/Desktop/chatgpt_history/` exists (user must export data manually) |
| Trae | `~/.trae/`, `~/.trae-cn/`, or App Support `Trae` directories exist (note: DB is encrypted) |
| OpenCode | `~/.local/share/opencode/opencode.db` exists |

Run a quick check:

```bash
echo "=== Detected AI tools ==="
[ -d ~/.claude/projects ] && echo "claude-code"
[ -d ~/.cursor/projects ] && echo "cursor"
[ -d ~/.codex ] && echo "codex"
[ -d ~/.openclaw ] && echo "openclaw"
[ -d ~/.gemini/tmp ] && echo "gemini-cli"
[ -d "$HOME/Library/Application Support/Antigravity" ] || [ -d ~/.gemini/antigravity ] && echo "antigravity"
[ -d ~/.codeium/windsurf ] || [ -d ~/.windsurf ] || [ -d "$HOME/Library/Application Support/Windsurf" ] && echo "windsurf"
[ -d ~/Desktop/chatgpt_history ] && echo "chatgpt"
[ -d "$HOME/Library/Application Support/Trae CN/ModularData/ai-agent" ] || [ -d "$HOME/Library/Application Support/Trae/ModularData/ai-agent" ] && echo "trae"
[ -f "$HOME/.local/share/opencode/opencode.db" ] && echo "opencode"
```

Then scan for **other coding agents** not in the list above. Look for dot-directories in `~/` and app directories in `~/Library/Application Support/` that look like AI coding tools (e.g. Kiro, Aider, Continue, Copilot Chat, Trae, Roo Code, etc.):

```bash
echo "=== Checking for other coding agents ==="
ls -d ~/.kiro ~/.aider* ~/.continue ~/.roo* 2>/dev/null || true
ls -d "$HOME/Library/Application Support/Kiro" "$HOME/Library/Application Support/Continue" 2>/dev/null || true
```

If you find any unknown tool directories, peek inside to see if they contain conversation logs (.jsonl, .json, .txt). If they do, include them — no need to ask the user.

Present the results: "Detected: Claude Code, Cursor. Also found: Kiro (has session logs)."

Set `PF_SOURCES` to the known tools for the script, and handle unknown tools manually in 2b.

### 2b. Find session files

Run the discovery script, targeting only the detected tools:

```bash
export PF_SOURCES="claude-code,cursor"  # only the detected ones from 2a
SESSION_LIST=$(bash "SKILL_DIR/scripts/discover-sessions.sh")
export SESSION_LIST
```

The script scans known locations for each tool and filters to the last 30 days. After running it:

1. **Check zero-session tools** — if a detected tool has 0 sessions, explore its data directory yourself to find files the script missed.
2. **Handle unknown tools** — for any extra coding agents discovered in 2a, explore their data directories, find conversation log files (.jsonl, .json, .txt), and append them to `$SESSION_LIST`.
3. **Ask the user** if they have session data in non-standard locations or from tools you didn't detect.

If you find additional session files, append them to `$SESSION_LIST`.

### 2c. Compute statistics + activity data

Run the stats script to compute token estimates and extract activity heat map data in a single pass:

```bash
python3 "SKILL_DIR/scripts/compute-stats.py"
```

This reads `$SESSION_LIST` and produces:
- **stdout**: session/token summary per source
- **`_pf_parts/activity.json`**: per-day activity data for the heat map visualization

### 2d. Present summary and ask user

Present a summary to the user:
- Total sessions found (last 30 days), grouped by **source**
- Activity heat map highlights: most active day, latest night, longest session
- Estimated total tokens (labeled as "estimated")

Then use **AskQuestion tool** to ask:

- Question: "Proceed with analysis?"
- Options:
  1. "Yes, analyze these sessions" — proceed to Step 3
  2. "No, let me adjust" — ask the user what to change

## Step 3: Analyze Conversations

### Parsing different formats

**Claude Code sessions (`.jsonl` in `~/.claude/projects/`):**
- Each line is a JSON object from the conversation transcript
- Read and analyze directly

**Cursor sessions — Plain text (`.txt` in `~/.cursor/projects/*/agent-transcripts/`):**
- Alternating `user:` and `assistant:` blocks
- User messages are wrapped in `<user_query>...</user_query>` tags
- Assistant messages may include `[Thinking]` sections
- Parse by splitting on `user:` / `assistant:` markers

**Cursor sessions — JSONL (`.jsonl` in `~/.curs