diff --git a/cheddahbot/tools/report_issue.py b/cheddahbot/tools/report_issue.py new file mode 100644 index 0000000..669ffaa --- /dev/null +++ b/cheddahbot/tools/report_issue.py @@ -0,0 +1,64 @@ +"""Tool for logging bugs and improvement requests that need Claude Code to fix.""" + +from __future__ import annotations + +import logging +from datetime import UTC, datetime +from pathlib import Path + +from . import tool + +log = logging.getLogger(__name__) + + +@tool( + "report_issue", + "Log a bug or improvement that needs Claude Code to fix. " + "Creates a structured entry in memory/improvement_requests.md.", + category="system", +) +def report_issue( + title: str, + description: str, + affected_files: str = "", + suggested_fix: str = "", + ctx: dict | None = None, +) -> str: + """Append a structured improvement request and index it in memory.""" + now = datetime.now(UTC) + timestamp = now.strftime("%Y-%m-%d %H:%M UTC") + + entry_lines = [ + f"\n## {title}", + f"**Reported:** {timestamp} ", + f"**Status:** pending\n", + description, + ] + + if affected_files: + entry_lines.append(f"\n**Affected files:** {affected_files}") + + if suggested_fix: + entry_lines.append(f"\n**Suggested Claude Code prompt:**\n> {suggested_fix}") + + entry_lines.append("\n---") + entry = "\n".join(entry_lines) + + # Write to the improvement requests file + requests_path = Path("memory/improvement_requests.md") + requests_path.parent.mkdir(parents=True, exist_ok=True) + + if requests_path.exists(): + content = requests_path.read_text(encoding="utf-8") + else: + content = "# Improvement Requests\n\nItems here need Claude Code (with codebase access) to fix.\n" + + content += entry + "\n" + requests_path.write_text(content, encoding="utf-8") + + # Also index into semantic memory for searchability + if ctx and ctx.get("memory"): + ctx["memory"].log_daily(f"Reported issue: {title} — {description}") + + log.info("Logged improvement request: %s", title) + return f"Logged improvement request: **{title}**. Bryan will see it on the next heartbeat." diff --git a/config.yaml b/config.yaml index d773416..933ac39 100644 --- a/config.yaml +++ b/config.yaml @@ -112,3 +112,9 @@ agents: display_name: Link Builder tools: [run_link_building, run_cora_backlinks, blm_ingest_cora, blm_generate_batch, scan_cora_folder, delegate_task, remember, search_memory] memory_scope: "" + + - name: planner + display_name: Planner + model: "anthropic/claude-sonnet-4.6" + tools: [delegate_task, remember, search_memory, report_issue, web_search] + memory_scope: "" diff --git a/identity/HEARTBEAT.md b/identity/HEARTBEAT.md index da06901..cbc4678 100644 --- a/identity/HEARTBEAT.md +++ b/identity/HEARTBEAT.md @@ -5,3 +5,4 @@ Things to proactively check on each heartbeat cycle: - Check if any scheduled tasks failed and need retry - Review memory for any pending reminders that are due - Check disk space (warn if < 10% free) +- Check memory/improvement_requests.md for pending items and notify Bryan with a summary