Skip to content
Open
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
15 changes: 15 additions & 0 deletions .agents/plugins/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@
"category": "Development & Workflow",
"description": "DevOps layer for coding agents with flow, feedback, and memory that compounds between sessions."
},
{
"name": "agent-workflow-system",
"displayName": "Agent Workflow System",
"source": {
"source": "local",
"path": "./plugins/1139030773-cmd/agent-workflow-system"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Development & Workflow",
"description": "一套中文AI工作流系统:7个协作技能 + 行为规范宪法 + 会话恢复机制。模糊目标→可执行任务,全生命周期引导。Codex & Claude Code 双平台,新手友好。",
"icon": "./plugins/1139030773-cmd/agent-workflow-system/assets/composer-icon.svg"
},
{
"name": "agiflow-ai-plugin",
"displayName": "AgiFlow",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Dev Auto-Push Hook (Windows)
# 关窗口时自动提交并推送系统改动到 GitHub
# 仅开发者环境有效(检测到 temp-desc 仓库才执行)

param(
[string]$ProjectDir = "c:\Users\11390\Documents\New project"
)

$RepoDir = Join-Path $ProjectDir "temp-desc"

# 不是开发环境,跳过
if (-not (Test-Path (Join-Path $RepoDir ".git"))) {
exit 0
}

try {
Push-Location $RepoDir

# 检查是否有未提交的改动
$status = git status --porcelain 2>$null
if (-not $status) {
Pop-Location
exit 0
}

# 自动提交
$now = Get-Date -Format "yyyy-MM-dd HH:mm"
git add -A 2>$null
git commit -m "auto: session checkpoint — $now" --quiet 2>$null

# 推送到远程
git push origin main --quiet 2>$null

Pop-Location
Write-Output "DevPush: auto-committed and pushed at $now"
} catch {
Pop-Location
Write-Output "DevPush: skipped ($_)"
exit 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Dev Auto-Push Hook (Linux/Mac)
# 关窗口时自动提交并推送系统改动到 GitHub
# 仅开发者环境有效(检测到 temp-desc 仓库才执行)

set -e

PROJECT_DIR="${1:-$PWD}"
REPO_DIR="$PROJECT_DIR/temp-desc"

# 不是开发环境,跳过
if [ ! -d "$REPO_DIR/.git" ]; then
exit 0
fi

cd "$REPO_DIR"

# 检查是否有未提交的改动
if [ -z "$(git status --porcelain 2>/dev/null)" ]; then
exit 0
fi

# 自动提交
NOW=$(date '+%Y-%m-%d %H:%M')
git add -A 2>/dev/null
git commit -m "auto: session checkpoint — $NOW" --quiet 2>/dev/null || true

# 推送到远程
git push origin main --quiet 2>/dev/null || true

echo "DevPush: auto-committed and pushed at $NOW"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# SessionEnd Hook 脚本
# 在会话正常关闭时自动记录时间戳到 RESUME.md
# 由 .claude/settings.local.json 中的 SessionEnd hook 调用

param(
[string]$ProjectDir = "c:\Users\11390\Documents\New project"
)

$resumePath = Join-Path $ProjectDir "RESUME.md"

if (-not (Test-Path $resumePath)) {
exit 0
}

try {
$content = Get-Content $resumePath -Raw -Encoding UTF8
$now = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$marker = "`n- **last_session_end**: $now`n"

# 更新 last_updated 时间戳
$content = $content -replace '- \*\*last_updated\*\*:.*', "- **last_updated**: $(Get-Date -Format 'yyyy-MM-dd')"

# 追加会话结束标记(如果还没有的话)
if ($content -notmatch 'last_session_end') {
$content += $marker
} else {
$content = $content -replace '- \*\*last_session_end\*\*:.*', "- **last_session_end**: $now"
}

Set-Content $resumePath -Value $content -Encoding UTF8 -NoNewline
Write-Output "SessionEnd: RESUME.md checkpoint updated at $now"
} catch {
Write-Output "SessionEnd: Failed to update RESUME.md - $_"
exit 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# SessionEnd Hook Script (Linux/Mac)
# Automatically records timestamp to RESUME.md on session close
# Called by SessionEnd hook in settings.local.json

set -e

PROJECT_DIR="${1:-$PWD}"
RESUME_PATH="$PROJECT_DIR/RESUME.md"

if [ ! -f "$RESUME_PATH" ]; then
exit 0
fi

NOW=$(date '+%Y-%m-%d %H:%M:%S')
TODAY=$(date '+%Y-%m-%d')

# Update last_updated timestamp
sed -i "s/- \*\*last_updated\*\*:.*/- **last_updated**: $TODAY/" "$RESUME_PATH"

# Append or update session_end marker
if grep -q 'last_session_end' "$RESUME_PATH"; then
sed -i "s/- \*\*last_session_end\*\*:.*/- **last_session_end**: $NOW/" "$RESUME_PATH"
else
echo "" >> "$RESUME_PATH"
echo "- **last_session_end**: $NOW" >> "$RESUME_PATH"
fi

echo "SessionEnd: RESUME.md checkpoint updated at $NOW"
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Agent Workflow System — 自动更新检查 (Windows)
# 每次 Claude Code 启动时静默检查,24h 内最多拉取一次
# 配置方法见 README.md

param(
[string]$MarketplaceDir = "$env:USERPROFILE\.claude\plugins\marketplaces\agent-workflow-system"
)

$StampFile = Join-Path $MarketplaceDir ".last-update-check"
$UpdateIntervalSec = 24 * 60 * 60 # 24 小时
$TimeoutSec = 5

# 如果 marketplace 目录不存在,跳过
if (-not (Test-Path $MarketplaceDir)) {
exit 0
}

# 如果距上次检查不足 24 小时,跳过
if (Test-Path $StampFile) {
try {
$lastCheck = [long](Get-Content $StampFile -Raw).Trim()
$now = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
if (($now - $lastCheck) -lt $UpdateIntervalSec) {
exit 0
}
} catch {
# 时间戳文件损坏,继续执行更新
}
}

# 带超时的 git pull
try {
$job = Start-Job -ScriptBlock {
param($dir)
Set-Location $dir
git pull --ff-only --quiet 2>$null
} -ArgumentList $MarketplaceDir

Wait-Job $job -Timeout $TimeoutSec | Out-Null
Stop-Job $job -ErrorAction SilentlyContinue
Remove-Job $job -Force -ErrorAction SilentlyContinue
} catch {
# git pull 失败时静默跳过
}

# 更新时间戳
try {
[DateTimeOffset]::UtcNow.ToUnixTimeSeconds().ToString() | Set-Content $StampFile -NoNewline
} catch {
# 写入失败时静默跳过
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Agent Workflow System — 自动更新检查
# 每次 Claude Code 启动时静默检查,24h 内最多拉取一次
# 配置方法见 README.md

set -e

MARKETPLACE_DIR="$HOME/.claude/plugins/marketplaces/agent-workflow-system"
STAMP_FILE="$MARKETPLACE_DIR/.last-update-check"
UPDATE_INTERVAL_SEC=$((24 * 60 * 60)) # 24 小时
TIMEOUT_SEC=5

# 如果 marketplace 目录不存在,跳过
if [ ! -d "$MARKETPLACE_DIR" ]; then
exit 0
fi

# 如果距上次检查不足 24 小时,跳过
if [ -f "$STAMP_FILE" ]; then
last_check=$(cat "$STAMP_FILE")
now=$(date +%s)
if [ $((now - last_check)) -lt $UPDATE_INTERVAL_SEC ]; then
exit 0
fi
fi

# 带超时的 git pull
timeout $TIMEOUT_SEC git -C "$MARKETPLACE_DIR" pull --ff-only --quiet 2>/dev/null || true

# 更新时间戳
date +%s > "$STAMP_FILE" 2>/dev/null || true
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"permissions": {
"allow": [
"PowerShell(claude-doctor *)",
"PowerShell(Get-Content *)",
"PowerShell(Set-Content *)",
"PowerShell(Join-Path *)",
"PowerShell(Test-Path *)",
"PowerShell(Get-Date *)",
"PowerShell(Write-Output *)",
"PowerShell(Start-Job *)",
"PowerShell(Wait-Job *)",
"PowerShell(Stop-Job *)",
"PowerShell(Remove-Job *)"
]
},
"hooks": {
"SessionEnd": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash .claude/hooks/session-end.sh",
"timeout": 15
},
{
"type": "command",
"command": "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File .claude/hooks/session-end.ps1",
"timeout": 15
},
{
"type": "command",
"command": "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File .claude/hooks/dev-push.ps1",
"timeout": 15
}
]
}
],
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash .claude/hooks/session-start.sh",
"timeout": 10
},
{
"type": "command",
"command": "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File .claude/hooks/session-start.ps1",
"timeout": 10
}
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
name: debug-fixer
description: 中文调试修复。用于报错、测试失败、页面异常、功能不符合预期时。由 workflow-system 或其他子技能调用。
allowed-tools: Bash, Read, Edit, Glob, Grep
---

# 调试修复

身份:**执行者**。只修一个问题,最小修复。不重构、不加功能、不改架构。

> 遵守 `references/BEHAVIOR_SPEC.md`、`references/STATE_MACHINE.md`、`references/EVIDENCE_CHAIN.md`。

## 📦 Artifact 交接

| 输入 | 输出 |
|------|------|
| `plan.md` | `patch.md`(模板: `references/artifacts/patch.md`) |

> 只读 plan.md + plan 中指定的文件范围。不读 plan 禁止修改的文件。不重新遍历项目。

## 📍 阶段位置

```
[●入口] → [●引导] → [●策划] → [◉执行] → [○审计] → [○收尾]
当前角色: 执行者·调试 | 上一站: 策划 | 下一站: 审计
```

> 当前阶段自动写入 `STATE_SNAPSHOT.md` 的 `current_phase` 字段。

## 启动自检

1. 读取 `BEHAVIOR_SPEC.md` 第一章:确认执行者边界
2. 读取 `STATE_MACHINE.md`:确认当前状态合法
3. 读取 `TASK_QUEUE.md`、`STATE_SNAPSHOT.md`
4. 偏离计数器清零
5. **恢复感知**(若为恢复会话):确认 RESUME.md 中 phase 字段匹配当前技能,不匹配时报告 workflow-system

## 硬边界(执行者 == 修问题,不扩张)

| 允许 | 禁止 |
|------|------|
| 读代码和日志 | **做架构决策** |
| 跑测试复现 | **顺手重构** |
| 最小修复 | **新增功能** |
| 加回归测试 | **静默改变方向** |
| 确认/写测试先行于修复 | **跳过 TDD 校验** |
| 调 /drift-auditor 报告结构问题 | **跳过校验** |

## 工作流程

1. 明确现象(对齐 `BEHAVIOR_SPEC.md` §2)
2. 复现问题
3. 收集文件和日志
4. 找根因
5. **TDD 前置校验**:
- [ ] 已有测试覆盖此场景?→ 跳过,直接进入修复前校验
- [ ] 无测试覆盖?→ 先写可复现失败的最小测试
- [ ] 代码先于测试存在?→ 回退代码,从写测试开始重走
6. **修复前校验**:
- [ ] 这是最小修复?没顺手重构?没加功能?
- [ ] 涉及架构/接口/数据变更?→ 停,调 `/project-master` 走决策闸门
- [ ] 修复方案涉及安全/隐私绕过?→ 触发法律觉察(`BEHAVIOR_SPEC.md` §8.2)
- [ ] 回滚点已记录?
7. 执行最小修复
8. 验证修复
9. **交互预算自检**(`BEHAVIOR_SPEC.md` §7.3):
- [ ] 修复结果信息量 ≤1 个决策点?
- [ ] 剩余风险清单是否清晰可逐个确认?
10. 汇报剩余风险 + 证据链

## 修复原则(BEHAVIOR_SPEC.md §2.4)

- 最小改动优先 / 不重构 / 不加功能 / 不改架构
- 优先加小回归测试

## TDD 约束

- 修复前必须有测试覆盖(已有测试或新建测试)
- 顺序强制:写测试 → 确认测试失败(复现 bug)→ 最小修复 → 确认测试通过
- 代码先于测试存在 → 回退代码,从写测试开始重走
- 例外场景(必须在报告中注明,不可静默跳过):
- 无法自动化测试的 UI 动效
- 硬件交互 / 外部 API 不可控
- 纯配置变更(无逻辑代码)

## 偏离处理(BEHAVIOR_SPEC.md 第四章)

| 次数 | 动作 |
|------|------|
| 第 1 次 | 自查,回滚 |
| 第 2 次 | /drift-auditor 深度审计 |
| 第 3 次 | 冻结 → 人工介入 |
Loading
Loading