fleet-memory/hindsight-api-slim/hindsight_api/alembic/versions
Kagura 585ac76f39
fix(claude-code): implement tool_choice support for forced tool calls (#733)
* fix(claude-code): implement tool_choice support for forced tool calls

The call_with_tools() method now properly handles the tool_choice parameter
to force specific tool calls. Previously, the parameter was accepted but ignored,
causing the reflect agent to fail when trying to force specific tools on each
iteration.

Fixes #732

Changes:
- When tool_choice forces a specific function: filter allowed_tools to only
  that tool (with mcp prefix) and add a strong system prompt instruction
- When tool_choice is 'required': add instruction that model must call at
  least one tool
- When tool_choice is 'none': clear allowed_tools and mcp_servers to disable
  all tools
- When tool_choice is 'auto' (default): no change (existing behavior)

This matches the approach used in the OpenAI provider while adapting to the
Claude Agent SDK's lack of native tool_choice parameter by using allowed_tools
filtering and system prompt instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix ruff formatting in alembic migration

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 10:30:53 +02:00
..
5a366d414dce_initial_schema.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
a1b2c3d4e5f6_add_file_storage_table.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
a2b3c4d5e6f7_add_text_signals_column.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
a2b3c4d5e6f8_add_gin_index_source_memory_ids.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
a3b4c5d6e7f8_add_consolidation_failed_at_to_memory_units.py fix: prevent silent memory loss on consolidation LLM failure (#601) 2026-03-17 20:15:33 +01:00
aa2b3c4d5e6f_nullable_event_date.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
b3c4d5e6f7a8_add_content_hash_to_chunks.py feat(retain): delta retain — skip LLM for unchanged chunks on upsert (#701) 2026-03-26 13:50:55 +01:00
b3c4d5e6f7g8_add_temporal_date_indexes.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
b4c5d6e7f8a9_backfill_observation_scopes.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
b7c4d8e9f1a2_add_chunks_table.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
c1a2b3d4e5f6_enable_pg_trgm_and_entities_trgm_index.py Fix pg_trgm unavailability causing startup crash and silent retain failures (#626) (#649) 2026-03-23 09:18:59 +01:00
c2d3e4f5g6h7_add_audit_log_table.py feat: add audit log for feature usage tracking (#717) 2026-03-27 09:52:03 +01:00
c3d4e5f6g7h8_add_history_to_mental_models.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
c5d6e7f8a9b0_add_bank_id_to_memory_links.py fix(claude-code): implement tool_choice support for forced tool calls (#733) 2026-03-30 10:30:53 +02:00
c8e5f2a3b4d1_add_retain_params_to_documents.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
d2e3f4a5b6c7_add_memory_links_expansion_indexes.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
d4e5f6g7h8i9_gin_source_memory_ids_fastupdate_off.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
d5e6f7a8b9c0_add_bank_internal_id_and_per_bank_hnsw.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
d9f6a3b4c5e2_rename_bank_to_interactions.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
e0a1b2c3d4e5_disposition_to_3_traits.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
e4f5a6b7c8d9_add_webhooks_tables.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
e5f6g7h8i9j0_cascade_delete_ops_on_bank_delete.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
f1a2b3c4d5e6_add_memory_links_composite_index.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
f6g7h8i9j0k1_chunk_fk_cascade_delete.py fix(migration): use IF EXISTS when dropping chunk FK constraint (#725) 2026-03-27 14:56:43 +01:00
f7g8h9i0j1k2_add_webhook_http_config.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
g2a3b4c5d6e7_add_tags_column.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
g7h8i9j0k1l2_backsweep_orphan_observations.py fix(migration): backsweep orphaned observation memory units (#584) 2026-03-16 14:06:33 +01:00
h3c4d5e6f7g8_mental_models_v4.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
i4d5e6f7g8h9_delete_opinions.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
j5e6f7g8h9i0_mental_model_versions.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
k6f7g8h9i0j1_add_directive_subtype.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
l7g8h9i0j1k2_add_worker_columns.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
m8h9i0j1k2l3_mental_model_id_to_text.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
n9i0j1k2l3m4_learnings_and_pinned_reflections.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
o0j1k2l3m4n5_migrate_mental_models_data.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
p1k2l3m4n5o6_new_knowledge_architecture.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
q2l3m4n5o6p7_fix_mental_model_fact_type.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
r3m4n5o6p7q8_add_reflect_response_to_reflections.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
rename_personality_to_disposition.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
s4n5o6p7q8r9_add_consolidated_at_to_memory_units.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
t5o6p7q8r9s0_rename_mental_models_to_observations.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
u6p7q8r9s0t1_mental_models_text_id.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
v7q8r9s0t1u2_add_max_tokens_to_mental_models.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
w8r9s0t1u2v3_fix_mental_models_pk_isolation.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
x9s0t1u2v3w4_add_bank_config_column.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
y0t1u2v3w4x5_add_result_metadata_gin_index.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
z1u2v3w4x5y6_add_observation_tags_to_memory_units.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00