chore: dev loop prompt rewrite + branch safety + tox conventions
- timmy-loop-prompt.md: full rewrite (76→209 lines) with PR-only workflow, tox environments, git hooks, Kimi dispatch safety block, conventional commits - kimi-code skill: added Branch & Convention Safety section - memories/MEMORY.md: updated with branch protection notes - config.yaml: removed dead kimi API key - cron/jobs.json: updated scheduled jobs - channel_directory.json: minor update - .gitignore: exclude queue/ and *.db
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -58,5 +58,11 @@ bin/*
|
||||
!bin/timmy-tmux.sh
|
||||
!bin/timmy-watchdog.sh
|
||||
|
||||
# ── Queue (transient task queue) ─────────────────────────────────────
|
||||
queue/
|
||||
|
||||
# ── Database files (ephemeral, regeneratable) ────────────────────────
|
||||
*.db
|
||||
|
||||
# ── OS junk ──────────────────────────────────────────────────────────
|
||||
.DS_Store
|
||||
|
||||
@@ -6,16 +6,108 @@ GITEA TOKEN: ~/.hermes/gitea_token (hermes user — NOT ~/.config/gitea/token)
|
||||
STATE: ~/Timmy-Time-dashboard/.loop/state.json
|
||||
CLAIMS: ~/Timmy-Time-dashboard/.loop/claims.json
|
||||
|
||||
RULES:
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
RULES
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
- Lines of code is a liability. Delete as much as you create.
|
||||
- Merge or revert. Main is always deployable. Never leave it broken.
|
||||
- Main is protected. ALL changes go through PRs. No direct pushes to main.
|
||||
- The soul is the spec. When issues run dry, read SOUL.md and find gaps.
|
||||
- Building sovereign Timmy is the north star.
|
||||
- ALWAYS clean up worktrees after merge: git worktree remove /tmp/timmy-cycle-N
|
||||
- ALWAYS release claims when done: hermes-claim drop <issue#>
|
||||
- Run tests ONCE per issue. One pass is enough.
|
||||
|
||||
DELEGATION — MANDATORY:
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
GIT WORKFLOW — PR-ONLY (branch protection enforced on Gitea)
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Direct pushes to main are REJECTED by the server. Every change reaches main
|
||||
through a Pull Request. This applies to you, Kimi, and all agents.
|
||||
|
||||
BRANCH NAMING:
|
||||
fix/<description> — bug fixes
|
||||
feat/<description> — new features
|
||||
refactor/<description> — refactors
|
||||
policy/<description> — policy/docs changes
|
||||
|
||||
COMMIT MESSAGES — conventional commits:
|
||||
fix: <description> (#issue)
|
||||
feat: <description> (#issue)
|
||||
refactor: <description> (#issue)
|
||||
test: <description> (#issue)
|
||||
chore: <description>
|
||||
perf: <description> (#issue)
|
||||
policy: <description>
|
||||
|
||||
PR TITLES — tag with loop cycle:
|
||||
[loop-cycle-N] fix: <description> (#issue)
|
||||
|
||||
THE WORKFLOW:
|
||||
1. git worktree add -b fix/thing /tmp/timmy-cycle-N main
|
||||
2. Dispatch Kimi to the worktree (see KIMI DISPATCH below)
|
||||
3. Review: cd /tmp/timmy-cycle-N && git diff --stat
|
||||
4. Test: cd /tmp/timmy-cycle-N && tox -e unit
|
||||
5. Commit: git add -A && git commit --no-verify -m "fix: thing (#issue)"
|
||||
6. Push: git push --no-verify origin fix/thing
|
||||
7. PR: Gitea API → POST /repos/.../pulls
|
||||
8. Merge: Gitea API → POST /repos/.../pulls/N/merge
|
||||
9. Cleanup: git worktree remove /tmp/timmy-cycle-N
|
||||
|
||||
NEVER:
|
||||
- git push origin main
|
||||
- git checkout main && git merge fix/thing
|
||||
- git push without a branch name
|
||||
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
TOX ENVIRONMENTS — the single source of truth for all Python tasks
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
tox is the ONLY way to run tests, linting, and formatting. Never run pytest
|
||||
or ruff directly. All config lives in tox.ini.
|
||||
|
||||
WHICH TOX ENV TO USE:
|
||||
tox -e unit — fast unit tests, parallel. USE THIS for CI gate.
|
||||
tox -e lint — ruff check + format check + inline CSS check
|
||||
tox -e format — auto-format code (ruff fix + ruff format)
|
||||
tox -e fast — unit + integration combined
|
||||
tox -e ci — full CI suite with coverage + JUnit XML
|
||||
tox -e pre-push — lint + full CI (mirrors Gitea Actions exactly)
|
||||
tox -e all — everything, parallel
|
||||
|
||||
FOR THE LOOP, USE:
|
||||
tox -e unit — to validate Kimi's work before committing
|
||||
tox -e format — if ruff complains about formatting
|
||||
|
||||
DO NOT USE:
|
||||
python3 -m pytest tests/ ... — use tox -e unit instead
|
||||
ruff check ... — use tox -e lint instead
|
||||
ruff format ... — use tox -e format instead
|
||||
|
||||
ENVIRONMENT VARIABLES (set automatically by tox):
|
||||
TIMMY_TEST_MODE=1
|
||||
TIMMY_DISABLE_CSRF=1
|
||||
TIMMY_SKIP_EMBEDDINGS=1
|
||||
|
||||
COVERAGE THRESHOLD: 73% (enforced in ci and coverage envs)
|
||||
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
GIT HOOKS (via .githooks/, activated by core.hooksPath)
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Pre-commit hook: auto-formats with tox -e format, then runs tox -e unit (60s limit)
|
||||
Pre-push hook: runs tox -e pre-push (lint + full CI mirror)
|
||||
|
||||
In worktrees, hooks may not be active. That means YOU must be the gate.
|
||||
Always run tox -e unit in the worktree before committing.
|
||||
|
||||
To bypass hooks when you've already validated: --no-verify
|
||||
git commit --no-verify -m "..."
|
||||
git push --no-verify origin branch
|
||||
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
DELEGATION — MANDATORY
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
You MUST delegate ALL coding to Kimi. You are the architect, Kimi is the coder.
|
||||
Your Anthropic tokens are expensive. Kimi's are free and fast. USE KIMI.
|
||||
|
||||
@@ -26,39 +118,81 @@ Kimi is a coding agent — it reads files, writes changes directly, writes tests
|
||||
It does NOT output diffs to stdout. It edits files in place in the worktree.
|
||||
After Kimi runs, check `git diff` in the worktree to see what it did.
|
||||
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
KIMI DISPATCH — BRANCH SAFETY (MANDATORY IN EVERY PROMPT)
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Every Kimi prompt MUST include the git safety block below. No exceptions.
|
||||
Replace {BRANCH} with the actual branch name.
|
||||
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ Include this VERBATIM in every Kimi prompt: │
|
||||
│ │
|
||||
│ GIT RULES — NON-NEGOTIABLE: │
|
||||
│ - You are on branch '{BRANCH}'. Stay on it. │
|
||||
│ - Do NOT checkout, merge, rebase, or push to main. │
|
||||
│ - Commit your changes to THIS branch only. │
|
||||
│ - Do NOT run 'git push'. The orchestrator handles pushing and PRs. │
|
||||
│ - If tests fail, fix them here. Do not switch branches. │
|
||||
│ │
|
||||
│ TESTING: │
|
||||
│ - Run tests with: tox -e unit │
|
||||
│ - Do NOT run pytest directly. Always use tox. │
|
||||
│ - Do NOT modify tox.ini, pyproject.toml, or CI config. │
|
||||
│ │
|
||||
│ CODE STYLE: │
|
||||
│ - Ruff handles formatting. Do not manually format. │
|
||||
│ - Run 'tox -e format' if you need to auto-fix style. │
|
||||
│ - Follow existing patterns in the codebase. │
|
||||
│ - No cloud dependencies. All AI runs on localhost via Ollama. │
|
||||
│ - Never use innerHTML with untrusted content (XSS). │
|
||||
│ - Never hardcode secrets. Use config.settings. │
|
||||
└─────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
WHY: On 2026-03-14, Kimi pushed broken code directly to main (bbbbdcd) because
|
||||
the prompt said "commit when done" without branch constraints. Never again.
|
||||
|
||||
IDEAL KIMI TASK SCOPE:
|
||||
- One focused task per invocation (fix a bug, add a feature, write tests)
|
||||
- Give it: exact file paths, what the code should do, test command to verify
|
||||
- Kimi has 262K context — paste relevant code snippets into the prompt
|
||||
- Good: "Fix the prefix match bug in _get_ollama_model() in src/timmy/tools_intro/__init__.py. Use exact matching. Add tests."
|
||||
- Good: "Fix the prefix match bug in _get_ollama_model(). Use exact matching. Add tests."
|
||||
- Bad: "Fix all the issues in the codebase" (too broad, will hallucinate)
|
||||
|
||||
PARALLEL KIMI TASKS:
|
||||
Kimi has no rate limits. You can run multiple tasks in parallel using & :
|
||||
Kimi has no rate limits. Run multiple tasks in parallel using & :
|
||||
kimi --print -p "Write the code fix..." -w /tmp/timmy-cycle-N &
|
||||
kimi --print -p "Write tests for..." -w /tmp/timmy-cycle-N-tests &
|
||||
wait
|
||||
Use separate worktrees if tasks touch the same files. Use one worktree if tasks
|
||||
touch different files (Kimi writes in place).
|
||||
Use separate worktrees if tasks touch the same files.
|
||||
|
||||
KIMI AVOID: CI/pyproject.toml/tox.ini, cloud calls, removing tests.
|
||||
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
YOUR JOB vs KIMI'S JOB
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
YOUR JOB: Read code, understand the problem, write precise Kimi prompts,
|
||||
review output, run tox, manage PRs.
|
||||
|
||||
YOUR JOB: Read code, understand the problem, write precise Kimi prompts, review output, run tests, manage PRs.
|
||||
KIMI'S JOB: Write ALL code changes and tests. Period.
|
||||
|
||||
ONLY exception: changes under 5 lines (typos, config values).
|
||||
If you catch yourself writing code, STOP and delegate to Kimi.
|
||||
|
||||
KIMI AVOID: CI/pyproject.toml, cloud calls, removing tests.
|
||||
Test: cd WORKTREE && ~/Timmy-Time-dashboard/.venv/bin/python -m pytest tests/ -x -q --timeout=30
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
YOUR CYCLE
|
||||
═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
YOUR CYCLE:
|
||||
1. Read state.json and claims.json
|
||||
2. Fetch open issues from Gitea API
|
||||
3. Pick 1-3 UNCLAIMED issues you can finish in time (parallelize if independent)
|
||||
4. Claim them: hermes-claim take <issue#>
|
||||
5. Create worktrees: git worktree add /tmp/timmy-cycle-N-issueX fix/description
|
||||
6. Read relevant code, write Kimi prompts, launch Kimi (parallel if multiple)
|
||||
7. Review Kimi's output (git diff), run tests ONCE. If pass: push, PR, merge.
|
||||
8. If fail: re-prompt Kimi with the error, or revert. Do not fix it yourself.
|
||||
9. Clean up: git worktree remove, hermes-claim drop
|
||||
1. Read state.json and claims.json
|
||||
2. Fetch open issues from Gitea API
|
||||
3. Pick 1-3 UNCLAIMED issues you can finish in time (parallelize if independent)
|
||||
4. Claim them: hermes-claim take <issue#>
|
||||
5. Create worktrees: git worktree add -b fix/description /tmp/timmy-cycle-N main
|
||||
6. Read relevant code, write Kimi prompts (with branch safety block), launch Kimi
|
||||
7. Review Kimi's output (git diff), run tox -e unit. If pass: commit, push, PR, merge.
|
||||
8. If fail: re-prompt Kimi with the error, or revert. Do not fix it yourself.
|
||||
9. Clean up: git worktree remove, hermes-claim drop
|
||||
10. Update state.json (append to arrays, don't replace)
|
||||
11. If no issues left: read SOUL.md, file new issues for gaps
|
||||
|
||||
@@ -70,7 +204,6 @@ Timeout after 30s if he hangs. Log observations in state.json.
|
||||
IMPORTANT:
|
||||
- Tag PRs: [loop-cycle-N] in title
|
||||
- Tag new issues: [loop-generated]
|
||||
- Do NOT run pre-push hooks separately — tests already ran.
|
||||
- Do NOT write code yourself. Delegate to Kimi.
|
||||
|
||||
Do your work now.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"updated_at": "2026-03-14T17:59:29.552651",
|
||||
"updated_at": "2026-03-14T21:24:54.914098",
|
||||
"platforms": {
|
||||
"discord": [
|
||||
{
|
||||
|
||||
@@ -187,8 +187,6 @@ custom_providers:
|
||||
api_key: ollama
|
||||
model: NousResearch/Hermes-4.3-36B
|
||||
fallback_model:
|
||||
- provider: kimi-coding
|
||||
model: kimi-k2.5
|
||||
- provider: custom
|
||||
model: qwen3:30b
|
||||
base_url: http://localhost:11434/v1
|
||||
|
||||
@@ -35,17 +35,40 @@
|
||||
"schedule_display": "every 5m",
|
||||
"repeat": {
|
||||
"times": null,
|
||||
"completed": 29
|
||||
"completed": 70
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "2026-03-14T15:32:37.430426-04:00",
|
||||
"next_run_at": "2026-03-14T18:03:29.472483-04:00",
|
||||
"last_run_at": "2026-03-14T17:58:29.472483-04:00",
|
||||
"next_run_at": "2026-03-14T21:28:54.837301-04:00",
|
||||
"last_run_at": "2026-03-14T21:23:54.837301-04:00",
|
||||
"last_status": "error",
|
||||
"last_error": "RuntimeError: Unknown provider 'anthropic'.",
|
||||
"deliver": "local",
|
||||
"origin": null
|
||||
},
|
||||
{
|
||||
"id": "b7886e805cab",
|
||||
"name": "dev-loop-tick",
|
||||
"prompt": "Send a TICK to the DevLoop tmux session to trigger the next dev cycle. Execute this exact command:\n\ntmux send-keys -t DevLoop:hermes \"TICK\" Enter\n\nThen check if it was accepted by running:\n\ntmux capture-pane -t DevLoop:0.0 -p -S -5\n\nReport what you see \u2014 whether DevLoop acknowledged the tick or if the session needs attention.",
|
||||
"schedule": {
|
||||
"kind": "interval",
|
||||
"minutes": 8,
|
||||
"display": "every 8m"
|
||||
},
|
||||
"schedule_display": "every 8m",
|
||||
"repeat": {
|
||||
"times": null,
|
||||
"completed": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "2026-03-14T21:25:31.831983-04:00",
|
||||
"next_run_at": "2026-03-14T21:33:31.832387-04:00",
|
||||
"last_run_at": null,
|
||||
"last_status": null,
|
||||
"last_error": null,
|
||||
"deliver": "local",
|
||||
"origin": null
|
||||
}
|
||||
],
|
||||
"updated_at": "2026-03-14T17:58:29.472631-04:00"
|
||||
"updated_at": "2026-03-14T21:25:31.835472-04:00"
|
||||
}
|
||||
@@ -2,8 +2,10 @@ Gitea (localhost:3000): Users: rockachopa(admin), hermes(id=4), manus(id=3), kim
|
||||
§
|
||||
Timmy architecture plan: Replace hardcoded _PERSONAS and TimmyOrchestrator with YAML-driven agent config (agents.yaml). One seed class, all differentiation via config. User wants to update YAML files, not Python, to add capabilities. Key files to refactor: agents/timmy.py, agents/base.py, tools_delegation/__init__.py, tools_intro/__init__.py. SubAgent class stays mostly as-is, just reads from YAML. Routing should be config-based pattern matching, not LLM calls. Per-agent model assignment (big model for orchestrator/code/research, small for simple tasks). qwen3:30b pulling as primary local model (~18GB, MoE 3B active).
|
||||
§
|
||||
Hermes-Timmy workspace set up at ~/Timmy-Time-dashboard/workspace/. Flat file correspondence journal (correspondence.md), inbox/ (Hermes→Timmy), outbox/ (Timmy→Hermes), shared/ (handoff patterns, reference docs). Protocol: append-only, timestamped. Plan: plug into Timmy's heartbeat tick so he auto-replies to new correspondence.
|
||||
Hermes-Timmy workspace: ~/Timmy-Time-dashboard/workspace/. Flat file correspondence, append-only.
|
||||
§
|
||||
2026-03-14: Fixed issues #36-#40, #52. Built voice loop, fallback chain, source control. Built self-prompt queue. Upgraded Timmy to qwen3:30b with num_ctx=4096 cap (19GB VRAM, fits 39GB Mac). Loop v2: 20min timeout, claim TTL expiry, timeout cleanup, Timmy triage+review integration, 58% smaller prompt. Filed eval issues #77-#87. Status panel: ~/.hermes/bin/timmy-status.sh.
|
||||
§
|
||||
2026-03-14 voice session: Built sovereign voice loop (timmy voice). Piper TTS + Whisper STT + Ollama, all local. Fixed event loop (persistent loop for MCP sessions), markdown stripping for TTS, MCP noise suppression, clean shutdown hooks. 1234 tests passing. Alexander wants to eventually train a custom voice using his own voice samples — noted for future.
|
||||
2026-03-14 voice session: Built sovereign voice loop (timmy voice). Piper TTS + Whisper STT + Ollama, all local. Fixed event loop (persistent loop for MCP sessions), markdown stripping for TTS, MCP noise suppression, clean shutdown hooks. 1234 tests passing. Alexander wants to eventually train a custom voice using his own voice samples — noted for future.
|
||||
§
|
||||
Hermes fallback: anthropic → local qwen3:30b only. No chain, simple single fallback. Kimi not used.
|
||||
@@ -81,3 +81,36 @@ process(action="wait", session_id="<id1>", timeout=180)
|
||||
5. **Background for long tasks** — use `background=true` + `process(action="wait")`
|
||||
6. **Parallel is fine** — run multiple Kimi processes across worktrees
|
||||
7. **Set timeout generously** — Kimi can take 1-3 minutes for complex tasks
|
||||
|
||||
## Branch & Convention Safety (MANDATORY in every Kimi prompt)
|
||||
|
||||
Kimi WILL push to main and run bare pytest if you don't tell it not to.
|
||||
Always include these constraints in EVERY Kimi prompt — copy verbatim,
|
||||
replacing {BRANCH} with the actual branch name:
|
||||
|
||||
```
|
||||
GIT RULES — NON-NEGOTIABLE:
|
||||
- You are on branch '{BRANCH}'. Stay on it.
|
||||
- Do NOT checkout, merge, rebase, or push to main.
|
||||
- Commit your changes to THIS branch only.
|
||||
- Do NOT run 'git push'. The orchestrator handles pushing and PRs.
|
||||
- If tests fail, fix them here. Do not switch branches.
|
||||
|
||||
TESTING:
|
||||
- Run tests with: tox -e unit
|
||||
- Do NOT run pytest directly. Always use tox.
|
||||
- Do NOT modify tox.ini, pyproject.toml, or CI config.
|
||||
|
||||
CODE STYLE:
|
||||
- Ruff handles formatting. Do not manually format.
|
||||
- Run 'tox -e format' if you need to auto-fix style.
|
||||
- Follow existing patterns in the codebase.
|
||||
- No cloud dependencies. All AI runs on localhost via Ollama.
|
||||
- Never use innerHTML with untrusted content (XSS).
|
||||
- Never hardcode secrets. Use config.settings.
|
||||
```
|
||||
|
||||
WHY: On 2026-03-14, Kimi pushed a broken commit directly to main because
|
||||
the prompt said "Commit when done" without branch constraints. This broke
|
||||
all active worktrees. Branch protection is now enforced on Gitea, but the
|
||||
prompt must also be explicit — defense in depth.
|
||||
|
||||
Reference in New Issue
Block a user