Reference material (IPs, playbooks, commands):
docs/developer/AUTOBOT_REFERENCE.mdStatus updates:docs/system-state.mdWorktrees: Use.worktrees/(project-local, gitignored) for all parallel/isolated work
Every task must:
- Link to GitHub Issue — ALL work in https://github.com/mrveiss/AutoBot-AI (MANDATORY)
- Search Memory MCP first:
mcp__memory__search_nodes - Break down into subtasks — Add as checklist in GitHub issue
- Use specialized agents for complex tasks
- Code review is mandatory — use
code-revieweragent - Update GitHub Issue throughout work with progress comments
- Complete properly — All code committed, criteria met, issue closed with summary
- Store in Memory MCP at session end
Before proceeding, verify:
- Work tied to GitHub issue? If NO: Create/link first
- Subtasks added to issue as checklist? If NO: Add now
- Memory MCP searched? If NO: Search now
- Complex tasks delegated to agents? If NO: Delegate
- Fixing root cause (not workaround)? If NO: STOP
- Integration needs both frontend AND backend? If YES: Plan BOTH
If ANY fails then STOP and correct immediately
These six rules override convenience, speed, and assumptions. No exceptions.
Before writing a single line of code or documentation:
- Search for existing implementations:
grep/globorgit log --oneline --grep="<topic>" - Check existing docs:
ls docs/,gh issue list, recent commits - Review related files in the same module/directory
- Search Memory MCP:
mcp__memory__search_nodesfor prior decisions - Only after confirming nothing exists should you write new code or docs
Before implementing anything, verify:
- Is the issue still open?
gh issue view <number> - Are there any existing PRs or branches?
gh pr list | grep <issue> - Any recent commits?
git log --oneline -20 --grep="<keywords>" - Is there already code that partially implements this? Quick grep/glob search
If you find existing work, USE IT — don't reimplement from scratch.
Violation: Writing a utility that already exists in
autobot-shared/, or starting implementation without checking for an existing PR.
Always prefer existing code over new code:
- Import and call existing utilities, helpers, and services
- Extend existing classes/functions rather than duplicating logic
- Use
autobot-shared/utilities before writing custom implementations - If similar code exists elsewhere, refactor to share it — never copy-paste
Redis Client — always use canonical utility:
from autobot_shared.redis_client import get_redis_client
redis_client = get_redis_client(async_client=False, database="main")
# NEVER: redis.Redis(host="172.16.168.23", ...)Databases: main, knowledge, prompts, analytics
Hardcoding Prevention — always use SSOT config:
from autobot_shared.ssot_config import config
redis_host = config.redis.hostimport { getBackendUrl } from '@/config/ssot-config'Pre-commit hook enforces this. Guide: docs/developer/HARDCODING_PREVENTION.md
Network Configuration — never hardcode IPs:
Always check existing config files for correct network ranges. Use environment variables or SSOT config. Flag any hardcoded IPs in legacy code for removal.
Violation: Writing a new Redis helper when
autobot_shared.redis_client.get_redis_clientalready exists, or hardcoding172.16.168.23.
Write code that others can reuse:
- Place shared logic in
autobot-shared/or the appropriate shared module - Match existing naming, signatures, and patterns in the codebase
- Generalize implementations when the cost is low (no over-engineering)
- Avoid one-off implementations that can't be called from elsewhere
Function Length:
| Lines | Action |
|---|---|
| ≤30 | Ideal |
| 31–50 | Consider refactoring |
| 51–65 | Must refactor before merge |
| >65 | Immediate refactoring required |
Use Extract Method pattern: create _helper_function() with docstring referencing parent issue.
File Naming — FORBIDDEN suffixes: _fix, _v2, _optimized, _new, _temp, _backup, _old, date suffixes. Version control handles versions.
Consolidation: When merging duplicate code — preserve ALL features + choose BEST implementation. Never drop features for convenience.
Code Ownership: mrveiss is the SOLE OWNER and AUTHOR of ALL AutoBot code.
# AutoBot - AI-Powered Automation Platform
# Copyright (c) 2025 mrveiss
# Author: mrveissUTF-8 Encoding: Always use encoding='utf-8' explicitly. Guide: docs/developer/UTF8_ENFORCEMENT.md
Logging:
# Backend
import logging
logger = logging.getLogger(__name__)
logger.info("Message: %s", data)// Frontend
import { createLogger } from '@/utils/debugUtils'
const logger = createLogger('ComponentName')No console.* or print() — pre-commit blocks these.
Violation: Hardcoding a value that belongs in SSOT config, or writing a private helper that duplicates a public one.
Before touching any code, ensure requirements are complete:
- Read the full issue/PRD and identify every gap, ambiguity, or missing edge case
- Ask all clarifying questions UP FRONT in a single pass — not mid-implementation
- Do not start until you can describe the complete expected end result in concrete terms
Questions to ask before starting:
- What is the exact expected input and output?
- Are there edge cases or error states that must be handled?
- Are there UI/UX, performance, or security constraints not stated?
- Does this touch other systems that need coordinating changes?
Simplicity First — always prefer the simplest approach:
- When the user asks to remove/fix something, do NOT add extra validation or defensive code unless requested
- If the scope is unclear, ASK rather than assuming a more complex approach
- Solve the stated problem — don't over-engineer for hypothetical edge cases
Architecture Confirmation — before implementing any ambiguous task, state:
- Approach: What method/pattern you'll use
- Assumptions: What you're assuming about architecture, startup, deployment
- Scope: What will change and what will stay the same
Wait for user confirmation before writing code. Do NOT assume systemd vs docker-compose, Ansible vs manual, new mode vs extending existing.
No Temporary Fixes (ZERO TOLERANCE):
- No quick fixes, workarounds, or disabling functionality
- No hardcoding to bypass issues, try/catch hiding errors
- No "TODO: fix later" comments
- Identify root problem → fix underlying issue → verify → remove workarounds
Violation: Starting implementation from a vague issue, or creating a "partition mode" when the existing mode just needs extension.
Before claiming any work is done, show evidence it works:
- Run the relevant test, lint check, curl, or build command and include the output
- Never say "done", "fixed", or "complete" without proof
- If the change touches multiple layers (backend + frontend, multiple nodes), verify each one
Issue is complete ONLY when:
- All code committed with issue refs
- All acceptance criteria verified
- Tests passing
- Code reviewed
- Closing summary added to issue
- Issue status = closed
Pre-commit & Linting:
- Maximum line length: 100 characters (enforced by flake8/ruff)
- After ANY commit attempt, verify changes were actually committed:
git log -1 --stat git diff
- If hooks revert edits, fix the underlying issue (don't retry blindly)
- Never mix unrelated staged files — stage and commit in focused batches
- Bulk operations: commit in batches of 10–15 files max
- NEVER use
git commit --no-verify
Post-commit verification:
git log --oneline -1 # Verify commit message and branch
git diff --staged # Ensure nothing unexpectedly left stagedDeployment Verification Checklist — after deploying to ANY remote server:
- No .env override conflicts:
grep -E "(HOST|PORT|PASSWORD)" /path/to/.env - Correct Python interpreter:
which python3— Main: Python 3.12 conda env; SLM/fleet: Python 3.10 venv/opt/autobot/venv - Database migrations current:
cd /opt/autobot && source venv/bin/activate && alembic current - Service actually restarted:
sudo systemctl status autobot-backend --no-pager && journalctl -u autobot-backend -n 50 --no-pager - Endpoints responding:
curl -sk https://localhost:8443/api/health | jq - No errors in recent logs:
journalctl -u autobot-backend --since "30 seconds ago" | grep -i error
Only proceed to next task if ALL six checks pass.
Violation: Saying "the bug is fixed" after editing a file without running the code.
"It was already there" is never a reason to ignore a problem.
Every bug, inconsistency, security issue, hardcoded value, or tech debt found — regardless of current task — must be reported:
- Create a GitHub issue immediately with description, severity, and location
- Report to the user and ask for direction: fix now, fix after current task, or defer
- Do not assume someone else knows about it
Discovered Problems Policy:
If you discover a NEW problem (not in GitHub):
gh issue create --title "Bug: <description>" --body "## Problem
<what's wrong>
## Discovered During
Working on #<original-issue>
## Impact
<severity: critical/high/medium/low>"Then ask:
Created issue #<new-number> for <problem>.
Should I: a) Fix now b) Finish current issue first c) Leave for later
If you discover a problem ALREADY in GitHub:
- ❌ DO NOT auto-start working on it
- ✅ Note it and link if related
If you discover technical debt:
- ❌ DO NOT refactor without permission
- ✅ Create issue: "Refactor: "
- ✅ Note: "Created # for future improvement"
Classification:
Fix immediately WITHOUT asking:
- Security vulnerability in code you're modifying
- Data corruption risk
- Syntax error that breaks tests
- Import error blocking your changes
Create issue + ASK before fixing:
- Performance problem, code smell, missing documentation, refactoring opportunity
Create issue + DEFER (don't ask):
- Minor style issues, optimization opportunities, unrelated bugs
One Issue Per Session Rule:
When an issue is complete:
- ✅ Report completion with summary
- ✅ Verify issue is closed:
gh issue view <number> - ❌ DO NOT auto-start other existing issues
- ❌ DO NOT suggest working on related issues without asking
- ❌ DO NOT scan for more work
Wait for explicit user instruction before starting new work.
Multi-Session Coordination:
Each session stays in its issue scope. If Session A discovers a bug in Session B's area → create issue, let user coordinate.
Violation: Noticing a broken error handler and not creating a GitHub issue because "it's not my task."
Implementation First:
- Prefer direct implementation over extended brainstorming/design phases
- When the user says "work on issue #X", brief plan (max 10 lines) then implement
- Do NOT invoke brainstorming skills when direct answers are needed
Implementation Approach:
- For large features (backend + frontend), complete and commit backend fully first
- Commit completed work incrementally — don't wait until everything is done
- After writing each file, verify it exists on disk before moving on
- When a fix applies to a component on multiple nodes: check all nodes, fix all of them
- If approaching context limit: stop at phase boundary, commit, add GitHub comment with next steps
Branch Strategy:
- Always target
Dev_new_guifor PRs and merges unless explicitly told otherwise - After completing work: delete remote feature branches and prune stale branches
Pre-Flight Checks (before ANY code changes):
- Verify current branch:
git branch --show-current - Check for uncommitted work:
git status - Check for stashes:
git stash list— if present, ask user how to handle - Verify target branch:
git fetch origin Dev_new_gui && git log --oneline origin/Dev_new_gui -3
Rules for ~/.claude/projects/.../memory/MEMORY.md:
- Target <150 lines. Hard limit 200 (truncated after).
- One line per closed issue:
#NNN: phrase. Commit abc1234. - Archive when Recent Completed exceeds 30 items →
completed-history.md - CLAUDE.md owns stable patterns. MEMORY.md owns recent state only.
End-of-session ritual:
- Close any issues? → Move to Recent Completed (1 line each)
- Any gotcha resolved? → Delete it
- Recent Completed >30? → Archive oldest batch
- MEMORY.md >150 lines? → Trim with
/memory-cleanup
Git Operations:
- Do NOT create/apply/drop
git stashunless explicitly requested - Do NOT switch branches unless explicitly requested
- When pushing, use
git pull --rebase(never discard others' work)
Scoped Commits:
- "commit" = YOUR changes only
- "commit all" = everything in grouped chunks
File Handling: When you see unrecognized files, keep going. Focus on your changes.
- Prefer incremental
Editover full fileWritefor files longer than 50 lines - Never rewrite entire files when only a few sections need changes
Write: new files, files under 50 linesEdit: existing files over 50 lines, targeted changes
Prefer direct implementation over subagents — reserve agents for exploration/research of unfamiliar areas.
Before spawning parallel subagents:
- Verify worktree:
ls -la ../worktrees/ 2>/dev/null || mkdir -p ../worktrees/ - Test one agent first before dispatching many
- If agent hangs >5 minutes, fail fast
- Fallback plan: switch to sequential branch-based implementation
If subagent fails: Switch to direct implementation immediately. Do NOT retry.
Subagent success pattern: Pre-flight → test one agent → dispatch parallel → monitor → fallback to sequential if needed.
R-P-I Workflow (ONLY for): code-skeptic (risk analysis), systems-architect (architecture design)
Available Agents:
- Implementation:
senior-backend-engineer,frontend-engineer,database-engineer,devops-engineer,testing-engineer,code-reviewer(MANDATORY),documentation-engineer - Analysis:
code-skeptic,systems-architect,performance-engineer,security-auditor,ai-ml-engineer - Planning:
project-task-planner,project-manager
Commit format: <type>(scope): <description> (#issue-number)
Always close the issue after implementation:
- Run
gh issue close <number>and verify withgh issue view <number> - Add closing comment summarizing what was done
PR Workflow — Review Mode (PR link only): read gh pr view/diff, do NOT switch branches or change code.
PR Workflow — Landing Mode:
- Create integration branch from
main - Bring in PR commits (prefer rebase)
- Apply fixes, add changelog
- Run full gate locally before committing
- Commit with contributor attribution
- Merge back to
main
Form a hypothesis before running commands:
- State: "I think X is caused by Y because Z"
- List 3–4 specific commands that confirm or reject it
- Run them in order
- Update hypothesis before running more
Auto-retry on transient errors (API 500, tool interruptions) up to 2 times before asking the user. Log: "Retrying (attempt 2/2)..."
Lookup tables, IPs, playbooks, sync commands, quick commands: