Skip to content

feat(f034.5): Dynamic Heartbeat Checks#252

Merged
tfatykhov merged 2 commits intomainfrom
feat/f034.5-dynamic-heartbeat-checks
Apr 5, 2026
Merged

feat(f034.5): Dynamic Heartbeat Checks#252
tfatykhov merged 2 commits intomainfrom
feat/f034.5-dynamic-heartbeat-checks

Conversation

@tfatykhov
Copy link
Copy Markdown
Owner

Summary

  • Dynamic heartbeat checks — prompt-driven checks that can be created/managed via conversation or REST API, running alongside permanent built-in checks
  • Full lifecycle integration — dynamic checks produce findings that flow through FindingStore (dedup, escalation, digest) and consume the daily token budget
  • Tool filtering — new tool_filter param on AgentRunner.run_turn() restricts dynamic checks to sensor-only tools (web_search, web_fetch, recall_deep, recall_recent, bash, read_file)

New Components

Component Description
DynamicCheck BaseCheck subclass with LLM prompt execution, croniter scheduling, tool allowlist
DynamicCheckLoader DB sync engine with CRUD, change detection, run stats tracking
DynamicCheckModel SQLAlchemy ORM model for nous_system.dynamic_checks
Migration 027 dynamic_checks table with UUID PK, agent_id scoping, composite unique constraint

Tools

  • heartbeat_check_create — create dynamic checks from conversation
  • heartbeat_check_manage — list/enable/disable/delete/update checks

REST Endpoints

  • GET /heartbeat/checks/dynamic — list all
  • POST /heartbeat/checks/dynamic — create
  • PATCH /heartbeat/checks/dynamic/{name} — update
  • DELETE /heartbeat/checks/dynamic/{name} — delete
  • POST /heartbeat/checks/dynamic/{name}/trigger — force-run

Architecture Review

3-agent review team found 5 P1s in the spec (phantom file paths, missing tool_filter API, broken croniter usage, _id_to_name bug, missing token tracking). All resolved before implementation.

Implementation Review

2-agent review found 0 P1, 7 P2 (all fixed): runtime state preservation on re-sync, type validation on updates, empty name/prompt rejection, interval validation on cron removal, trigger_check DB stat tracking, empty summary filtering.

Test plan

  • 51 new tests in test_heartbeat_dynamic.py covering init, scheduling, execution, parsing, loader sync, CRUD, run stats, runner integration, tool filtering
  • 142 existing heartbeat tests still pass (zero regressions)
  • All module imports verified clean
  • Manual test: create check via conversation, verify it runs on next tick
  • Manual test: disable/delete check, verify it stops running

🤖 Generated with Claude Code

Add prompt-driven heartbeat checks that can be created and managed via
conversation or REST API, running alongside permanent built-in checks.

New files:
- nous/heartbeat/dynamic.py: DynamicCheck (BaseCheck subclass with LLM
  prompt execution, cron scheduling, tool allowlist) + DynamicCheckLoader
  (DB sync, CRUD, run stats tracking)
- sql/migrations/027_dynamic_checks.sql: nous_system.dynamic_checks table
- tests/test_heartbeat_dynamic.py: 51 tests covering all components

Modified files:
- nous/api/runner.py: Add tool_filter param to run_turn() and _tool_loop()
  for restricting available tools per-turn (sensor-only enforcement)
- nous/api/tools.py: Register heartbeat_check_create and
  heartbeat_check_manage tools
- nous/api/rest.py: 5 REST endpoints at /heartbeat/checks/dynamic/*
- nous/heartbeat/runner.py: DynamicCheckLoader integration with periodic
  sync, token budget tracking, and DB run stats
- nous/main.py: Wire DynamicCheckLoader into heartbeat startup
- nous/storage/models.py: DynamicCheckModel ORM class
- nous/config.py: heartbeat_max_dynamic_checks, heartbeat_dynamic_sync_ticks
- nous/heartbeat/schemas.py: tokens_used field on CheckResult
- nous/heartbeat/__init__.py: Export new classes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

- CLAUDE.md: Add F034.5 to shipped table, 2 env vars, 5 REST endpoints,
  2 agent tools, dynamic.py in project structure, update table count to 28
- INDEX.md: Add F034.5 to Proactive Autonomy section and Implementation
  Specs table, update stats (28 tables, 23 tools, 62 endpoints)
- F034.5 spec: Update status from PROPOSED to SHIPPED

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tfatykhov tfatykhov merged commit ab50e18 into main Apr 5, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant