---
version: 0.2.8
name: cawplan-coding-commit
description: |
Use when the user asks to collect, generate, summarize, submit, upload, or report CawPlan AI coding session daily reports from local agent data or existing ai-daily JSON files.
NOT for: git commits, viewing insights, querying costs, searching tickets, or QA/测试会话日报 (use cawplan-qa-commit).
argument-hint: "[date, file path, or agent name]"
allowed-tools: Bash
---
# CawPlan Coding Commit
## Bootstrap
```bash
cawplan skill check
```
## Workflow
This skill supports two workflows:
- **Single-day workflow:** Collect → Assign → Review → Upload → Current-Month Backfill
- **Month-missing workflow:** Query cloud missing dates for a month → collect and upload only missing dates
Supported single-day arguments:
- no date, `today` → today's date
- `yesterday`, `yestoday` → yesterday's date (`yestoday` is accepted as a common typo)
- `YYYY-MM-DD` → the exact report date
- natural-language requests that ask to upload yesterday's daily report → yesterday's date
- natural-language requests that ask to upload the daily report for a specific `YYYY-MM-DD` date → that exact date
Supported month-missing arguments:
- `last month` → the previous calendar month
- `YYYY-MM` → that exact calendar month
- natural-language requests that ask to upload/fill missing daily reports for a specific month → that calendar month
Examples:
- `/cawplan-coding-commit`
- `/cawplan-coding-commit yesterday`
- `/cawplan-coding-commit 2026-06-20`
- `/cawplan-coding-commit last month`
- `/cawplan-coding-commit 2026-06`
If the user provides a single-day argument, resolve it before Step 1 and use that date in every command below. If the user provides a month-missing argument, skip the single-day workflow and follow **Month-missing workflow** below. If the user provides an unsupported argument, ask for a valid date or month instead of guessing.
Always collect and present the AI-summarized review before uploading. Do not wait for a second confirmation after the review; proceed to upload immediately.
## Permission Minimization
Minimize permission prompts during report collection:
- Run each logical phase as one shell block instead of many tiny commands.
- When using Cursor agent shell tools for any collection phase, request full network access once for the whole shell block (`required_permissions: ["full_network"]`), because collection may call the Cursor Dashboard API at `cursor.com`.
- Store every generated `ai-daily-*.json` report in a system temporary directory, not in the current repository. This avoids repository write prompts and keeps generated report files out of the working tree.
- Reuse the same workflow-scoped temp directory for collect, assign, review, and upload.
- For Web assignment, batch all files in a single `cawplan session assign --web --files ...` command. Do not start one assignment command per report.
Before collecting reports, create one workflow-scoped temp directory via the CLI so the same command works on macOS, Linux, and Windows:
```bash
report_dir="$(cawplan session temp-dir)"
```
Use absolute file paths under this directory for every subsequent collect, assign, review, and upload step:
```bash
report_file="$report_dir/ai-daily-.json"
```
Do not write generated daily report JSON files into the current working directory unless the user explicitly provides an output path.
### Month-Missing Workflow
Use this workflow when the user asks to upload/fill missing reports for a month, or provides a month argument such as `last month` or `YYYY-MM`.
**Step M1 — Resolve month range:**
- For `last month`, use the first and last day of the previous calendar month.
- For a past `YYYY-MM`, use the first and last day of that month.
- For the current `YYYY-MM`, use the first day of the month through today.
- Never include dates outside the requested month.
**Step M2 — Query cloud missing dates:**
```bash
cawplan session backfill --from --to --dry-run
```
Only use `missing_dates` from this dry run. Do not collect or overwrite dates that are already uploaded. If `missing_dates` is empty, tell the user there are no missing reports for the requested month and stop.
**Step M3 — Collect missing dates with bounded concurrency:**
```bash
collect_concurrency="${CAWPLAN_COLLECT_CONCURRENCY:-5}"
i=0
for date in ...; do
cawplan session collect --date $date --output "$report_dir/ai-daily-$date.json" &
i=$((i + 1))
if [ $((i % collect_concurrency)) -eq 0 ]; then
wait
fi
done
wait
```
Use bounded concurrency because each collection may call the Cursor Dashboard API. The default concurrency is 5; reduce `CAWPLAN_COLLECT_CONCURRENCY` only when the network or Cursor API is unstable.
**Step M4 — Product/repo/ticket assignment:**
Run **Product/repo/ticket assignment** for all newly collected files.
**Step M5 — Ticket progress write-back:**
Run **Ticket Progress Write-Back** below for every newly collected missing-date report that has `sessions[].ticket_ids`.
**Step M6 — Upload missing reports:**
Upload each newly collected missing-date file individually in date order:
```bash
cawplan session report --file "$report_dir/ai-daily-.json"
```
After upload, report the requested month, uploaded dates, number of sessions per uploaded report, and each server response code.
### Single-Day Workflow
**Step 1 — Collect:**
```bash
report_file="$report_dir/ai-daily-.json"
cawplan session collect --date --output "$report_file"
```
**Step 2 — Product/repo/ticket assignment:**
Run **Product/repo/ticket assignment** for `$report_file`, then complete the review before continuing so product, repo, and ticket display IDs can be checked or edited.
**Step 3 — Review the report with the user:**
Present the full review described in **Review content contract**. Do not show only a stats table.
**Step 4 — Ticket context check:**
Do not ask the user to manually provide ticket IDs during reporting. `cawplan session collect` automatically parses explicit ticket refs from session `human_inputs`, including `ticket_id`, `ticket_display_id`, CawPlan issue URLs, and display IDs. Resolved tickets are preserved for review in the Web assignment page; assignment allows tickets from the selected product or another product in the same product line.
When reviewing `$report_file`, mention any `sessions[].ticket_ids` and `sessions[].ticket_display_ids` already present. Ticket context should come from explicit human-input refs or assignment-page edits; do not keyword-search or guess tickets.
**Step 5 — Ticket progress write-back:**
Run **Ticket Progress Write-Back** below if `$report_file` has any `sessions[].ticket_ids`. This step belongs to the skill workflow, not to `cawplan session assign --web`; assignment only saves product/repo/ticket links into the daily report.
**Step 6 — Upload:**
```bash
cawplan session report --file "$report_file"
```
**Step 7 — Query missing current-month reports:**
```bash
cawplan session backfill --from --to --dry-run
```
Use the first day of the report's month as `--from` and the report date as `--to`. Show the returned `missing_dates` to the user. If there are no missing dates, say so and stop.
**Step 8 — Collect each missing date with bounded concurrency:**
Launch missing dates with a small concurrency limit:
```bash
collect_concurrency="${CAWPLAN_COLLECT_CONCURRENCY:-5}"
i=0
for date in ...; do
cawplan session collect --date $date --output "$report_dir/ai-daily-$date.json" &
i=$((i + 1))
if [ $((i % collect_concurrency)) -eq 0 ]; then
wait
fi
done
wait
```
Each date is independent, but unbounded parallel collection can overload the Cursor Dashboard API and cause timeouts. The default concurrency is 5; reduce `CAWPLAN_COLLECT_CONCURRENCY` to 1 or 2 for unstable networks.
**Step 9 — Product/repo/ticket assignment for missing reports:**
Run **Product/repo/ticket assignment** for all newly collected files.
**Step 10 — Ticket progress write-back for missing reports:**
Run **Ticket Progress Write-Back** below for each newly collected file that has `sessions[].ticket_ids`.
**Step 11 — Upload missing reports:**
Upload each file individually in date order:
```bash
cawplan session report --file "$report_dir/ai-daily-.json"
```
Backfill must stay within the uploaded report's current month and must not cross month boundaries.
---
## Ticket Progress Write-Back
Use this step only after product/repo/ticket assignment has been reviewed and saved. Do not rely on `cawplan session assign --web` to update ticket details; the skill is responsible for this write-back.
1. Read the report JSON file and scan `sessions[].ticket_ids`.
2. Group sessions by `ticket_id`.
3. Resolve all grouped tickets through Cloud:
```bash
cawplan tickets search --unique_ids "," --page_size 100
```
4. For each group, only write back when the Cloud result has `unique_id`, `product_id`, and `version_id`, and every grouped session's `product_id` matches the returned ticket `product_id`. Skip unresolved tickets, tickets missing `product_id`/`version_id`, and product-mismatched tickets.
5. Generate compact HTML `progress_comment` by summarizing the grouped sessions' `human_inputs`. Do not copy raw prompts or only list classified topics. For each ticket group:
- Collect human inputs from both report-level `human_inputs[]` matching the grouped `session_id` values and each grouped `session.human_inputs[]`.
- For every collected human input, read only `content`; do not read or summarize `assistant_message` for ticket progress write-back.
- Summarize only the most important changed result, decision/direction, and unresolved follow-up in 1-3 short bullets.
- Keep each bullet compact, ideally one sentence and under 120 characters.
- Use session metadata such as title, agent, project, file counts, and line deltas only as supporting context.
- Do not include a separate "Updated from ..." paragraph; keep the comment visually dense.
- Do not insert blank lines in the final HTML. Keep adjacent tags contiguous; avoid empty lines between `
`, `