feat(acms): implement CRP tool handlers — request-context, query-history, get-context-budget #7398

Open
opened 2026-04-10 19:01:35 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit Message: feat(acms): implement CRP tool handlers — request-context, query-history, get-context-budget
  • Branch: feature/m5-acms-crp-tool-handlers
  • Milestone: v3.4.0
  • Parent Epic: #935

Background and Context

The ACMS (Advanced Context Management System) defines three built-in context tools in skills/builtins/context_ops.py:

  • builtin/request-context — actors request context during reasoning
  • builtin/query-history — actors query decision/plan history
  • builtin/get-context-budget — actors check remaining context budget

All three handlers currently raise NotImplementedError. This issue implements the handlers by wiring them to the ContextAssemblyPipeline and ContextTierService.

Expected Behavior

Actors can invoke these tools during reasoning to dynamically request and receive contextually relevant information. The handlers must:

  1. request-context: Accept a ContextRequest, invoke the pipeline, return AssembledContext
  2. query-history: Accept plan/decision filters, return relevant history fragments
  3. get-context-budget: Return current budget allocation for the calling actor

Acceptance Criteria

  • builtin/request-context handler wired to ContextAssemblyPipeline.assemble() — returns AssembledContext
  • builtin/query-history handler queries decision history from PlanRepository — returns filtered fragments
  • builtin/get-context-budget handler returns current budget from ContextBudget model
  • All handlers validate arguments per fail-fast principles
  • All handlers raise appropriate CleverAgentsError subtypes on failure (no silent suppression)
  • BDD scenarios cover happy path and error cases for each handler
  • Coverage >= 97%

Dependencies

  • Must be done after: ACMS pipeline components are implemented (StrategySelector, BudgetAllocator, StrategyExecutor)

Subtasks

  • Implement _handle_request_context() in context_ops.py — wire to ContextAssemblyPipeline
  • Implement _handle_query_history() — query PlanRepository for decision history
  • Implement _handle_get_context_budget() — return ContextBudget for current actor
  • Add argument validation to all three handlers
  • Tests (Behave): Add scenarios for request-context tool handler
  • Tests (Behave): Add scenarios for query-history tool handler
  • Tests (Behave): Add scenarios for get-context-budget tool handler
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Supervisor: Epic Planner | Agent: epic-planning-pool-supervisor

## Metadata - **Commit Message**: `feat(acms): implement CRP tool handlers — request-context, query-history, get-context-budget` - **Branch**: `feature/m5-acms-crp-tool-handlers` - **Milestone**: v3.4.0 - **Parent Epic**: #935 ## Background and Context The ACMS (Advanced Context Management System) defines three built-in context tools in `skills/builtins/context_ops.py`: - `builtin/request-context` — actors request context during reasoning - `builtin/query-history` — actors query decision/plan history - `builtin/get-context-budget` — actors check remaining context budget All three handlers currently raise `NotImplementedError`. This issue implements the handlers by wiring them to the `ContextAssemblyPipeline` and `ContextTierService`. ## Expected Behavior Actors can invoke these tools during reasoning to dynamically request and receive contextually relevant information. The handlers must: 1. `request-context`: Accept a `ContextRequest`, invoke the pipeline, return `AssembledContext` 2. `query-history`: Accept plan/decision filters, return relevant history fragments 3. `get-context-budget`: Return current budget allocation for the calling actor ## Acceptance Criteria - [ ] `builtin/request-context` handler wired to `ContextAssemblyPipeline.assemble()` — returns `AssembledContext` - [ ] `builtin/query-history` handler queries decision history from `PlanRepository` — returns filtered fragments - [ ] `builtin/get-context-budget` handler returns current budget from `ContextBudget` model - [ ] All handlers validate arguments per fail-fast principles - [ ] All handlers raise appropriate `CleverAgentsError` subtypes on failure (no silent suppression) - [ ] BDD scenarios cover happy path and error cases for each handler - [ ] Coverage >= 97% ## Dependencies - [ ] Must be done after: ACMS pipeline components are implemented (StrategySelector, BudgetAllocator, StrategyExecutor) ## Subtasks - [ ] Implement `_handle_request_context()` in `context_ops.py` — wire to `ContextAssemblyPipeline` - [ ] Implement `_handle_query_history()` — query `PlanRepository` for decision history - [ ] Implement `_handle_get_context_budget()` — return `ContextBudget` for current actor - [ ] Add argument validation to all three handlers - [ ] Tests (Behave): Add scenarios for `request-context` tool handler - [ ] Tests (Behave): Add scenarios for `query-history` tool handler - [ ] Tests (Behave): Add scenarios for `get-context-budget` tool handler - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: Epic Planner | Agent: epic-planning-pool-supervisor
HAL9000 added this to the v3.4.0 milestone 2026-04-10 19:03:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#7398
No description provided.