Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 83 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,30 +161,58 @@ A few weeks later:
"I no longer feel safe changing this code."
```

Pair Programming Skill changes the workflow to:

```text
Requirement / Design
↓
Design Gate
↓
Shadow Implementation
↓
Build / Test / Debug
↓
Record Pitfalls & Hidden Constraints
↓
Reverse Decomposition
↓
Guided Reconstruction
↓
AI Review / Hint / Explain
↓
Selective AI Takeover when useful
↓
Code you can actually maintain
### Complete command workflow

All 11 canonical `/pair` commands are shown below. Solid arrows show workflow progression;
dashed arrows show optional calls. Use the host-native invocation from the installation
table above; the command semantics stay the same. Grouped help commands are alternatives;
return to the current Human checkpoint after using one.

```mermaid
flowchart TB
plan["/pair plan &lt;goal-or-design&gt;<br/>Save the canonical design"]
gate{"Current revision approved?"}
waiting["Draft or revise design<br/>Stop and wait for approval"]
reference["Shadow: implement, test, debug; record Pitfalls<br/>Guide: derive and verify teachable commits"]
next["/pair next [step]<br/>Teach one ready step and its Pitfalls"]
human["Human coding checkpoint<br/>Implement or fix; Human stays in control"]
review["/pair review [scope]<br/>Check behavior, invariants and validation"]
passed{"Step passes acceptance?"}
remaining{"More steps?"}
complete["Feature complete<br/>Record verification and session outcome"]

plan --> gate
gate -->|No| waiting
waiting -->|Approve this revision| gate
gate -->|Yes| reference
reference --> next --> human --> review --> passed
passed -->|Fix needed| human
passed -->|Yes| remaining
remaining -->|Yes| next
remaining -->|No| complete

help["Optional help; no Human source changes<br/>/pair hint [scope] [level]: L1–4 progressive hints<br/>/pair explain &lt;scope&gt;: code, design, Pitfalls<br/>/pair show &lt;scope&gt;: Guide reference, not applied<br/>/pair challenge [scope]: 1–3 key questions"]
take["/pair take &lt;scope&gt;<br/>Approved revision + recovery reconciliation<br/>Checkpoint + journal BEFORE applying code<br/>Apply, validate, record outcome; return control"]
replan["/pair rebase-plan<br/>Preserve Human code; replan remaining work<br/>Not Git rebase; changed design needs approval"]
inspect["Read-only inspection at ANY phase<br/>/pair status: Git, drift, operations, Pitfalls<br/>/pair dashboard [options]: static control center<br/>--watch / --interval / --json<br/>--pair-dir or --workspace / --output"]

human -.->|As needed| help
help -.->|Hint level 5| take
human -.->|Delegate scope| take
take -->|Return to checkpoint| human
human -.->|Plan diverges| replan
replan -->|Refresh remaining reference| gate
plan -.->|Anytime| inspect
```

A complete user-provided design can open the approval gate immediately unless the request
is for planning/review only. A material design change always requires approval of the new
revision. `explain design`, `status` and `dashboard` also work while approval is pending.
Takeover stops if approval or recovery checks fail; it reconciles an interrupted operation
before starting another. Dashboard writes generated artifacts only; Watch requires a browser
reload. See the [command protocol](reference/command-protocol.md) for full arguments and
recovery rules.

The Shadow Workspace is the route AI has already flown once.

The Human Workspace is the code that ultimately matters.
Expand Down Expand Up @@ -790,6 +818,36 @@ Step 4 — locking boundary

---

### `/pair dashboard`

Generate a static view of existing `.pair` state: session, progress, plan, timeline, and
pitfalls. Open `.pair/dashboard/index.html` directly in a browser. The command does not
modify implementation code, Git refs, or workflow state and works while approval is pending.

```text
$pair-programming dashboard
/pair-programming dashboard --json
/pair dashboard --watch
/pair dashboard --workspace ~/workspace
/pair dashboard --pair-dir ./project/.pair --output ./dashboard-output
```

The installed skill includes the Python generator. Python 3.10+ and PyYAML are required
to read canonical YAML state. See [dashboard setup and usage](scripts/dashboard/README.md)
and the [dashboard contract](reference/dashboard.md).

`--watch` generates once, then polls state changes every second and reports step
transitions. Use `--interval <seconds>` to adjust polling and Ctrl-C to stop. Reload
the open HTML to display regenerated state; invalid intermediate input is retried
without replacing the last valid dashboard.

The control center also displays dependency/readiness information, suggested next commands,
recorded validation and knowledge coverage, implementation origin, and rebuildable session
history. Origin percentages use completed steps as the denominator and retain mixed/unknown.
Step completion excludes skipped/superseded entries; unavailable progress stays unknown.
The workspace option lists direct child projects, with individual detail pages and read-error
isolation. It also supports `--watch`; reload the static page after regeneration.

### `/pair rebase-plan`

This is **not** Git rebase.
Expand Down Expand Up @@ -1105,12 +1163,14 @@ pair-programming-skill/
│
├── scripts/
│ ├── check-guide.py
│ ├── dashboard/
│ ├── install.sh
│ ├── install.ps1
│ └── validate-package.py
│
├── reference/
│ ├── command-protocol.md
│ ├── dashboard.md
│ ├── decomposition.md
│ ├── design-gate.md
│ ├── guide-quality.md
Expand All @@ -1125,6 +1185,7 @@ pair-programming-skill/
│ ├── manifest.schema.json
│ ├── pitfalls.schema.json
│ ├── progress.schema.json
│ ├── session.schema.json
│ └── takeover-operation.schema.json
│
└── templates/
Expand Down
100 changes: 78 additions & 22 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,55 @@ Agent
几周之后:这段代码我已经不敢动了
```

Pair Programming Skill 把流程改成:

```text
需求 / 设计
↓
Design Gate
↓
Shadow 完整实现
↓
Build / Test / Debug
↓
记录踩坑与隐藏约束
↓
反向拆解为 Guide Steps
↓
你逐步实现
↓
AI Review / Hint / Explain
↓
需要时 AI 接管局部
↓
最终得到你真正能维护的代码
### 全部命令流程图

下图覆盖全部 11 条标准 `/pair` 命令。实线表示工作流推进,虚线表示按需调用。
实际使用时采用上方安装表中的宿主调用方式,命令语义保持一致。辅助命令按需选用,
调用后回到当前 Human 检查点,并非要求依次执行。

```mermaid
flowchart TB
plan["/pair plan &lt;goal-or-design&gt;<br/>保存标准设计文档"]
gate{"当前 revision 已批准?"}
waiting["起草或修改设计<br/>停止实现,等待明确批准"]
reference["Shadow:实现、测试、Debug,记录 Pitfalls<br/>Guide:拆解并验证教学提交链"]
next["/pair next [step]<br/>讲解一个可执行步骤及相关 Pitfalls"]
human["Human 编码检查点<br/>用户实现或修复,掌握控制权"]
review["/pair review [scope]<br/>检查行为、关键约束和验证证据"]
passed{"当前步骤验收通过?"}
remaining{"还有剩余步骤?"}
complete["Feature 完成<br/>记录验证证据和会话结果"]

plan --> gate
gate -->|否| waiting
waiting -->|批准当前 revision| gate
gate -->|是| reference
reference --> next --> human --> review --> passed
passed -->|需要修复| human
passed -->|是| remaining
remaining -->|是| next
remaining -->|否| complete

help["按需辅助,不修改 Human 源码<br/>/pair hint [scope] [level]:L1–4 渐进提示<br/>/pair explain &lt;scope&gt;:解释代码、设计、Pitfalls<br/>/pair show &lt;scope&gt;:查看 Guide,不应用代码<br/>/pair challenge [scope]:1–3 个关键问题"]
take["/pair take &lt;scope&gt;<br/>当前设计已批准 + 完成恢复对账<br/>修改前创建 checkpoint + operation journal<br/>应用、验证、记录结果,交还控制权"]
replan["/pair rebase-plan<br/>保留 Human 代码,重规划剩余工作<br/>不是 Git rebase;设计变化须重新批准"]
inspect["任意阶段均可只读查看<br/>/pair status:Git、漂移、operation、Pitfalls<br/>/pair dashboard [options]:静态控制中心<br/>--watch / --interval / --json<br/>--pair-dir 或 --workspace / --output"]

human -.->|按需调用| help
help -.->|hint 第 5 级| take
human -.->|委托选定范围| take
take -->|回到检查点| human
human -.->|计划产生分歧| replan
replan -->|更新剩余参考实现| gate
plan -.->|随时查看| inspect
```

用户直接提供的完整设计可打开审批门,除非明确只要求规划或评审;设计发生实质变化后,
必须重新批准新的 revision。等待批准时也能使用 `explain design`、`status` 和 `dashboard`。
接管的审批或恢复检查未通过时停止修改;有中断 operation 时先对账,再开始新的接管。
Dashboard 只写生成产物;Watch 更新后需刷新浏览器。完整参数与恢复规则见
[命令协议](reference/command-protocol.md)。

Shadow 是 AI 已经提前飞过一次的航线。

Human Workspace 才是最终代码。
Expand Down Expand Up @@ -789,6 +814,34 @@ Step 4 — locking boundary

---

### `/pair dashboard`

从现有 `.pair` 状态生成静态看板,展示会话、进度、计划、时间线和 Pitfalls。
直接用浏览器打开 `.pair/dashboard/index.html`。该命令只写入看板产物,不修改实现代码、
Git 引用或工作流状态;等待设计批准时也可以使用。

```text
$pair-programming dashboard
/pair-programming dashboard --json
/pair dashboard --watch
/pair dashboard --workspace ~/workspace
/pair dashboard --pair-dir ./project/.pair --output ./dashboard-output
```

安装包包含 Python 生成器。读取正式 YAML 状态需要 Python 3.10+ 和 PyYAML。
详见 [dashboard 安装与用法](scripts/dashboard/README.md) 和
[dashboard 生成契约](reference/dashboard.md)。

`--watch` 首次生成后默认每秒轮询一次状态变化,自动重新生成产物并报告步骤变化。
用 `--interval <seconds>` 调整轮询间隔,按 Ctrl-C 停止。已打开的 HTML 刷新后显示
新状态;读取到半写入或无效状态时保留上一份有效产物并继续重试。

控制中心还展示步骤依赖与可开始状态、建议的下一条命令、记录的验证结果和知识覆盖、
实现来源及可重建的会话历史。来源比例以已完成步骤为分母,保留 mixed/unknown;
步骤完成比例排除 skipped/superseded,进度来源缺失时保持未知。
Workspace 只扫描直接子项目,每个项目有详情页,读取错误单独展示;支持组合 `--watch`。
会话时间和结果只取明确的源记录,旧 Markdown 不推测真实时间或结果。

### `/pair rebase-plan`

这里的 rebase 不是 Git rebase。
Expand Down Expand Up @@ -1099,12 +1152,14 @@ pair-programming-skill/
│
├── scripts/
│ ├── check-guide.py
│ ├── dashboard/
│ ├── install.sh
│ ├── install.ps1
│ └── validate-package.py
│
├── reference/
│ ├── command-protocol.md
│ ├── dashboard.md
│ ├── decomposition.md
│ ├── design-gate.md
│ ├── guide-quality.md
Expand All @@ -1119,6 +1174,7 @@ pair-programming-skill/
│ ├── manifest.schema.json
│ ├── pitfalls.schema.json
│ ├── progress.schema.json
│ ├── session.schema.json
│ └── takeover-operation.schema.json
│
└── templates/
Expand Down
14 changes: 13 additions & 1 deletion SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name: pair-programming
description: >
Human-in-control pair programming with shadow implementation, guided reconstruction,
selective code takeover, semantic review, hints, challenges, and replanning. Use when
selective code takeover, semantic review, hints, challenges, replanning, and read-only
dashboards of Pair state. Use when
the user wants AI coding help without losing understanding or ownership of the code.
The agent first proves the feature in an isolated Git worktree/branch, then decomposes
the verified solution into teachable implementation steps and guides the user through
Expand Down Expand Up @@ -86,6 +87,7 @@ $pair-programming review
$pair-programming hint
$pair-programming take tests
$pair-programming status
$pair-programming dashboard

# Cursor / Claude Code / OpenCode
/pair-programming plan <goal-or-design>
Expand All @@ -94,6 +96,7 @@ $pair-programming status
/pair-programming hint
/pair-programming take tests
/pair-programming status
/pair-programming dashboard

# Gemini CLI
Use the pair-programming skill, then provide the semantic /pair command.
Expand All @@ -114,6 +117,7 @@ Canonical semantic protocol:
/pair take <scope>
/pair challenge [scope]
/pair status
/pair dashboard [--watch] [--interval <seconds>] [--json] [--pair-dir <path> | --workspace <path>] [--output <path>]
/pair rebase-plan
```

Expand Down Expand Up @@ -185,6 +189,12 @@ the next write. Stop on a newer unsupported schema version.
Initialize missing state from `templates/` only when needed. Do not rewrite unrelated state
just to normalize formatting.

When recording a session, use `templates/session-summary.md` frontmatter and
`schemas/session.schema.json`. Create one stable session ID and actual timezone-aware
start time, then update that same record with the actual end time and session outcome.
Session completion does not imply feature completion. Keep unknown metadata unknown;
dashboard/history exports never replace the source session record.

## Shadow layout

Resolve Git paths instead of assuming `.git` is a directory:
Expand Down Expand Up @@ -244,6 +254,7 @@ Always read `reference/command-protocol.md` for explicit commands.
| `/pair take` | Yes | `takeover.md`, `recovery.md`, `pitfall-journal.md`, `state-model.md` | Run transactional takeover; validate; return control. |
| `/pair challenge` | No | — | Ask 1–3 maintainability-critical questions; no trivia or arbitrary score. |
| `/pair status` | No | `state-model.md`, `recovery.md`, `pitfall-journal.md` | Compare metadata with real Git state and report current truth. |
| `/pair dashboard` | No | `dashboard.md`, `state-model.md` | Generate a read-only view using the packaged Python entrypoint; optionally poll with `--watch`; report artifact paths and the running terminal session. |
| `/pair rebase-plan` | No by default | `recovery.md`, `design-gate.md`, `decomposition.md`, `guide-quality.md`, `state-model.md` | Replan remaining work from authoritative Human code; this is not `git rebase`. |

## Plan → Shadow → Guide
Expand Down Expand Up @@ -430,5 +441,6 @@ Read only what the current operation requires.
| Human-code review | `reference/review-rubric.md` |
| Human Workspace takeover | `reference/takeover.md` |
| Session/operation recovery | `reference/recovery.md` |
| Dashboard generation and output | `reference/dashboard.md` |

Do not preload unrelated references simply because they exist.
4 changes: 4 additions & 0 deletions adapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ SKILL.md
reference/
templates/
examples/
schemas/
scripts/check-guide.py
scripts/dashboard/
```

## Portable-first strategy
Expand Down Expand Up @@ -59,6 +62,7 @@ The workflow's internal semantic protocol is always:
/pair take
/pair challenge
/pair status
/pair dashboard
/pair rebase-plan
```

Expand Down
1 change: 1 addition & 0 deletions adapters/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ references remain valid.
/pair-programming hint step 2
/pair-programming take tests
/pair-programming status
/pair-programming dashboard
```

Trailing arguments are normalized to the internal `/pair ...` semantic protocol.
Expand Down
1 change: 1 addition & 0 deletions adapters/codex.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $pair-programming review
$pair-programming hint step 2
$pair-programming take tests
$pair-programming status
$pair-programming dashboard
```

These host-native calls map to the internal `/pair ...` semantic protocol.
Expand Down
1 change: 1 addition & 0 deletions adapters/cursor.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ explicitly as a slash skill:
/pair-programming hint step 2
/pair-programming take tests
/pair-programming status
/pair-programming dashboard
```

The workflow keeps automatic invocation enabled; it does not set
Expand Down
1 change: 1 addition & 0 deletions adapters/gemini-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Gemini, use natural language such as:

```text
Use the pair-programming skill. Run the semantic command: /pair plan add capability registry
Use the pair-programming skill. Run the semantic command: /pair dashboard
```

Useful Gemini management commands:
Expand Down
1 change: 1 addition & 0 deletions adapters/github-copilot.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ explicitly, mention the slash-prefixed skill name in the prompt, for example:
```text
Use the /pair-programming skill to run: /pair plan add capability registry
Use the /pair-programming skill to run: /pair review
Use the /pair-programming skill to run: /pair dashboard
```

In Copilot CLI, use `/skills list` and `/skills info pair-programming` to inspect the
Expand Down
Loading