You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,75 +9,152 @@ This project uses Loop Engineering for automated maintenance. Core idea: shift f
9
9
| Prompt | How to ask | Each agent's system prompt |
10
10
| Context | What AI sees |`CODEBUDDY.md`, `STATE.md`|
11
11
| Harness | AI work environment | skills (project knowledge), allowed-tools (permission constraints) |
12
-
| Loop | What to do after each step | GitHub Actions triggers, agent five-phase iteration |
12
+
| Loop | What to do after each step | System cron + `codebuddy -p` (headless), or GitHub Actions |
13
+
14
+
## Execution Mode
15
+
16
+
This project supports two execution modes. **System cron is the primary mode** for environments where the CodeBuddy API is only reachable from an internal network (e.g. TKE private deployment).
17
+
18
+
### Mode 1: System Cron + Headless (Primary)
19
+
20
+
Each loop runs as a system cron job that invokes `codebuddy -p` (headless mode). Every run is a fresh, isolated session that reads `STATE.md` for context, executes the loop, and writes back `STATE.md`.
21
+
22
+
**Advantages:**
23
+
- No expiration — runs permanently, no need to re-create
-**Note**: This loop only tracks and reports. Sync of modified code is manual human work — cannot `go get -u` modified code.
70
-
71
148
## State Management
72
149
73
-
`STATE.md` (project root) is the shared state file for all loops. This is the core Loop Engineering principle — **state is external, not in model context**.
150
+
`STATE.md` (project root) is the shared state file for all loops. This is the core Loop Engineering principle — **state is external, not in model context**. Each cron run reads `STATE.md` at the start and writes back at the end.
74
151
75
152
## Cost Control
76
153
77
-
- Each loop has max iteration limits (dep upgrade 5, CI fix 3, issue triage 10, PR review 5)
78
-
-Uses `model: inherit`to reuse main session model
79
-
-Loops run only when needed (event-triggered or scheduled), not always-on
80
-
-GitHub Actions provides execution environment, no extra service cost
154
+
- Each loop runs once daily (not always-on), 10 min max per run
155
+
-Staggered schedule (01:00–05:00) to avoid API rate limits
156
+
-Headless mode (`-p`) uses minimal tokens per run
157
+
-30-day log retention (older logs auto-deleted)
81
158
82
159
## Autonomy Boundary
83
160
@@ -88,16 +165,17 @@ This project uses Loop Engineering for automated maintenance. Core idea: shift f
88
165
89
166
## How to Add a New Loop
90
167
91
-
1. Create a skill directory and `SKILL.md` under `skills/` (encode project knowledge)
92
-
2. Create an agent under `agents/` (define responsibilities, stop conditions, tool permissions)
93
-
3. Create a trigger workflow under `.github/workflows/` (scheduled or event-triggered)
94
-
4. Add a section to `STATE.md`
95
-
5. Reuse `code-reviewer` agent for implementation/review separation
96
-
6. Agents involving GitHub operations must declare `gh-cli` in `skills` field
97
-
7. Agent safety constraints must include no-tag/no-release rule
98
-
8. All skills must be project-level (under `.codebuddy/skills/`), never global
99
-
9. Set explicit max iteration limits (turn limits) to prevent infinite loops
100
-
10. All commit messages in English
168
+
1. Create a skill directory and `SKILL.md` under `.codebuddy/skills/` (encode project knowledge)
169
+
2. Create an agent under `.codebuddy/agents/` (define responsibilities, stop conditions, tool permissions)
170
+
3. Add a case to `.codebuddy/scripts/run-loop.sh` with the loop's prompt and tools
171
+
4. Add a cron entry in `.codebuddy/scripts/install-cron.sh`
172
+
5. Add a section to `STATE.md`
173
+
6. Reuse `code-reviewer` agent for implementation/review separation
174
+
7. Agents involving GitHub operations must declare `gh-cli` in `skills` field
175
+
8. Agent safety constraints must include no-tag/no-release rule
176
+
9. All skills must be project-level (under `.codebuddy/skills/`), never global
177
+
10. Set explicit max iteration limits (turn limits) to prevent infinite loops
178
+
11. All commit messages in English
101
179
102
180
## Inner Loop vs Outer Loop
103
181
@@ -119,8 +197,8 @@ Loop Engineering can accelerate "understanding debt" — the gap between the cod
0 commit comments