用 Claude Code 创建循环

用几个文件外置目标、记忆和规则,把 Claude 的一次性对话变成能自转的循环;真正的杠杆不是更聪明地提问,而是加上验证和最小权限阶梯的工程结构,让瓶颈从生成转向审查。

作者
@sairahul1
标签
循环Claude Code
NO.015收录 2026-07-06

TASK.md — 清晰定义目标

# Daily Project Review Loop

## Goal
Review this project folder, summarize what changed,
identify blockers, and produce a short daily review report.

## Expected Output
Each run should produce or update:
- `outputs/daily-review.md`
- `PROGRESS.md`

## Scope
Claude may inspect files in this workspace and write
reports to the `outputs/` folder.

Claude should NOT:
- Modify source files
- Delete or rename files
- Send messages or open tickets

PROGRESS.md — 循环的记忆

# Loop Progress

## Current State
- Status: Active
- Main objective: Daily project review
- Current focus: [what matters right now]
- Last updated: [date]

## Last Run
- Date:
- Summary:
- Files reviewed:
- Output produced:

## Open Items
-

## Blockers
-

## Needs Human Review
-

## Next Run Should
-

## Decisions Made
-

## Do Not Repeat
-

LOOP_INSTRUCTIONS.md — 操作流程

# Loop Instructions

You are running a daily project review loop.

## Before You Start
1. Read `TASK.md`
2. Read `PROGRESS.md`
3. Inspect the project folder
4. Identify what changed, what's incomplete, what needs human review

## What You Should Do
Write a short daily review to `outputs/daily-review.md` including:
- Summary of current state
- Files reviewed
- Meaningful changes
- Blockers or unresolved questions
- Recommended next actions

After writing, update `PROGRESS.md` with:
- Date of this run
- Summary of what happened
- Files checked
- What the next run should do
- Whether human review is needed

## Safety Rules
- Do not delete files
- Do not rename or move files
- Do not modify source files
- Only write to `outputs/daily-review.md` and `PROGRESS.md`
- If unsure whether an action is allowed → stop and ask

## Verification Checklist
Before ending the run, confirm:
- `outputs/daily-review.md` exists with all required sections
- `PROGRESS.md` was updated
- No files outside allowed paths were modified

## Failure Policy
If verification fails:
1. Missing section in report → fix once
2. PROGRESS.md not updated → update once
3. Forbidden file modified → stop immediately
4. Same check fails twice → mark as needing human review

手动运行你的第一个循环

Run the daily project review loop for this workspace.

Follow `LOOP_INSTRUCTIONS.md` exactly.

Before acting, read:
- `TASK.md`
- `PROGRESS.md`
- `LOOP_INSTRUCTIONS.md`

Then inspect the workspace, write the daily review to
`outputs/daily-review.md`, update `PROGRESS.md`,
run the verification checklist, and report what changed.

Do not modify any files except
`outputs/daily-review.md` and `PROGRESS.md`.

验证:大多数人都会跳过的部分

Run a verification pass for the latest loop execution.

Check the output against the Verification Checklist
in `LOOP_INSTRUCTIONS.md`.

Report:
1. Which checks passed
2. Which checks failed
3. Which files were modified
4. Whether the run is safe to accept
5. Whether human review is required

Do not modify any files during this verification pass.

用 /loop 排程

/loop 24h Run the daily project review loop for this workspace.

Follow `LOOP_INSTRUCTIONS.md` exactly.
Read `TASK.md` and `PROGRESS.md` first.
Write the report to `outputs/daily-review.md`.
Update `PROGRESS.md` before stopping.
Run the verification checklist.
If no meaningful changes → keep the report short.
If human review needed → mark clearly in `PROGRESS.md`.
Do not modify any files except `outputs/daily-review.md`
and `PROGRESS.md`.
/goal outputs/daily-review.md exists, PROGRESS.md is updated,
verification checklist passes, no forbidden files modified.

添加工具和连接器

## Tool Permissions Policy

### GitHub
Allowed:
- Read open issues
- Read pull request status
- Read CI status
- Draft summary in `outputs/github-review.md`
NOT allowed:
- Push commits
- Merge pull requests
- Close issues
- Comment publicly without approval

### Slack
Allowed:
- Draft message in `outputs/slack-update.md`
NOT allowed:
- Send messages
- Mention users
- Post to channels

### Linear/Jira
Allowed:
- Read assigned tickets
- Draft suggested updates
NOT allowed:
- Change status
- Close tickets
- Create tickets without approval