Conversation
Injects a `_tafc_think` reasoning field into tool schemas with
structural complexity >= tau (default 0.6). Complexity is measured
by schema depth, presence of anyOf/oneOf/allOf combinators, and enum
variant count. Think fields are stripped before tool execution and
before persisting to memory to avoid token inflation.
- TafcConfig { enabled, complexity_threshold } in [tools.tafc]
- schema_complexity() heuristic with structural JSON analysis
- augment_with_tafc() and strip_tafc_fields() in tool_execution/mod.rs
- TAFC augmentation in process_response_native_tools() (native tools path)
- strip before ToolCall execution and before MessagePart persistence
- WARN + Err when model produces only think fields (HIGH-02)
- --tafc CLI flag; /tafc TUI command (tafc:status); --init wizard step
- Subagent scope (run_inline_tool_loop) excluded (CRIT-01)
- 13 unit tests covering schema augmentation, stripping, config, edges
…1, HIGH-02, HIGH-03, SEC-01) - CRIT-01: add tafc_failed tracking and [error] ToolOutput synthesis for empty params - CRIT-02: document inline loop bypass (intentional design) - HIGH-01: add TafcConfig::validated() with bounds [0.0, 1.0] and NaN/Inf clamping - HIGH-02: extend schema_complexity with flat_params_score for many-param patterns - HIGH-03: expand audit trail doc comment (ephemeral semantics) - SEC-01: implement case-insensitive is_tafc_key() helper Add 5 new unit tests for fixed areas. All 5958 tests pass.
…alling Resolved conflicts: - tool_orchestrator.rs: keep both TafcConfig (TAFC) and ToolResultCache (main) - CHANGELOG.md: keep TAFC entry - config.rs, lib.rs, native.rs: take upstream (structural crate extraction changes) Main branch has advanced significantly with: - zeph-config, zeph-vault, zeph-experiments, zeph-sanitizer, zeph-subagent, zeph-orchestration crate extractions - AnchoredSummary for structured context compaction - ToolResultCache for session-scoped tool result caching - Dynamic tool schema filtering TAFC feature (issue #1861) coexists cleanly with these changes.
- Replace tool_def_to_definition with tool_def_to_definition_with_tafc in process_response_native_tools, gating on TafcConfig from ToolOrchestrator - Strip _tafc_think fields from tool call inputs before execution in handle_native_tool_calls; skip tool calls that produce only think fields - Fix clippy: add #[must_use] to TafcConfig::validated(), rewrite condition to avoid unnecessary boolean not, add backticks to doc comment - Export TafcConfig from zeph-tools crate public API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement Think-Augmented Function Calling (TAFC) — a research-driven feature that improves LLM parameter accuracy by allowing the model to reason about parameter values before committing them.
Source: arXiv 2601.18282 — "Think-Augmented Function Calling: Improving LLM Parameter Accuracy Through Embedded Reasoning"
Results (ToolBench benchmark):
Implementation
_tafc_thinkfield to tool definitions (complexity-based)_tafc_think*keys before tool dispatch — full backward compatibility[tools.tafc]TOML sub-table withenabled(default false) andcomplexity_threshold(default 0.6)--tafc, TUI command/tafc,--initwizard stepArchitecture Decisions
tool_def_to_definition()in zeph-core (all tools get TAFC augmentation)Validation Results
✓ Architect: Design approved with clarifications
✓ Critic (Architecture): Approved with conditions (subagent isolation, prefix consistency)
✓ Developer: Implementation complete, all fixes applied
✓ Tester: Coverage validated (13→18 unit tests, all edge cases)
✓ Impl-Critic: Code review approved (all CRIT/HIGH findings fixed)
✓ Reviewer: Final approval (all integration points present)
Key Fixes Applied
tafc_failedtracking +[error]ToolOutput synthesis for empty params after stripping_TAFC_THINKvariants)Test Coverage
Files Changed
crates/zeph-core/src/agent/builder.rs— apply bounds validationcrates/zeph-core/src/agent/mod.rs— document inline loop bypasscrates/zeph-core/src/agent/tool_execution/mod.rs— flat params score, audit trail docs, case-insensitive key checkcrates/zeph-core/src/agent/tool_execution/native.rs— tafc_failed tracking + error synthesiscrates/zeph-core/src/agent/tool_execution/tests.rs— 5 new testscrates/zeph-tools/src/config.rs— TafcConfig with validated() bounds checkPre-Commit Checks
✓
cargo +nightly fmt --check✓
cargo clippy --workspace --features full -- -D warnings✓
cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins(5958 tests)Phase 2 (Future)
_tafc_think_Pfor each complex param)Closes
#1861