KB / agents / autonomous-workflow
Autonomous Workflow Patterns
Patterns for running duyetbot autonomously — /loop for recurring tasks, background deploys, memory checkpoints before context compaction.
Autonomous Workflow Patterns
duyetbot can run autonomously within a session (via /loop) or as a one-shot task (via claude -p). These patterns reduce human-in-the-loop friction for routine maintenance.
Context compaction
Auto-compaction is explicitly welcomed when the conversation grows long. The user confirmed on 2026-05-25: "remember -> can compact to save tokens when needed."
Before compaction happens, save anything future turns will need into a memory file or commit body. Never repeat goal text verbatim in responses — the goal hook re-surfaces it on every stop. Commit messages are the most durable form of session memory.
Background deploys
Always run cf:deploy:prod in the background after pushing. Continue with the next task immediately. The harness notifies when the deploy completes; verify production after the notification.
Do NOT run two background deploys in parallel — cf-deploy-prod.sh renames .env.local → .env.local.deploy-bak during execution. Parallel invocations collide on that rename and lose CLOUDFLARE_API_TOKEN propagation.
Recurring task pattern (/loop)
/loop 1h "run PLAN.md maintenance: benchmark → assess → act → verify → ship"
Each iteration:
- Measure current state
- Fix the highest-priority issue
- Verify (lint + test + build pass)
- Commit and push
- Deploy in background
- Log to
memory/maintenance-log.md
Autonomous decision priority
When running unattended, address issues in this order:
- Build fails → fix immediately
- Tests fail → fix immediately
- Lint errors → auto-fix
- Deploy needed → verify then ship
- Code quality → improve if no higher-priority issues open
- New features → only from
memory/roadmap.md
Improvement rotation
Nine improvement cycles completed as of March 2026 (~155 total fixes). A cycle typically runs as a scoped /loop targeting one category (security, dead code, design, tests). Cycle 9 added 104 new tests and unified the design system across llm-timeline, cv, and homelab.