feat(demo): Add explore mode for schema discovery#97
Conversation
All implementation phases (1-5) have been completed, so references to them are no longer relevant. This removes the Implementation Phases section from architecture.md and updates phase-related text in the guidelines documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements explore mode where LLM discovers data structure via introspection operations (keys, typeof) instead of receiving full schema upfront. Changes: - Add --explore CLI flag and /mode commands to switch data modes - Refactor agent to use agentic loop (multi-turn with tool results) - Add /programs, /result, /context commands for debugging - Add PtcRunner.format_error/1 for LLM-friendly error messages - Update README with explore mode documentation Known issue: In explore mode, LLMs struggle to generate valid PTC programs due to DSL inconsistencies: - `get` requires `path` as list, but other ops use `field` string - No `sort_by` or `max_by` operations for common "find row with max" - Verbose patterns for simple field extraction See issue #93 for proposed DSL improvements to address this. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Track last_exec through agent_loop instead of extracting from context - Add truncation note to system prompt for LLM awareness - Remove unused extract_last_execution/1 function - Use character-based truncation (200 chars) instead of item count to preserve short lists like keys output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: feat(demo): Add explore mode for schema discoverySummaryThis PR adds an "explore mode" to the demo app where the LLM discovers data structures via introspection operations ( What's Good
Issues (Must Fix)
Suggestions (Optional)
SecurityNo security concerns. The sandbox execution and timeout limits remain intact. DocumentationDocumentation needs updates to reflect the removal of structured mode:
VerdictRequest Changes - The test_runner.ex bug would cause test runs to fail silently or use wrong mode. The README documentation inconsistencies would confuse users. These are mechanical fixes following the pattern established by the PR itself. 🤖 Generated with Claude Code |
|
@claude please fix these issues from PR review: Issue 1: test_runner.ex uses wrong parameter nameLocation:
Issue 2: test_runner.ex documentation references removed modesLocation:
If mode support is needed, update to use Issue 3: README.md still documents removed --structured flagLocation:
Issue 4: CLI silently ignores unrecognized --structured flagLocation: # Validate args - only --explore is supported
unknown_flags = Enum.filter(args, fn arg -> String.starts_with?(arg, "--") and arg != "--explore" end)
if unknown_flags != [] do
IO.puts("Unknown flags: #{Enum.join(unknown_flags, ", ")}. Only --explore is supported.")
System.halt(1)
endPlease fix ALL issues above in a SINGLE commit. Make minimal changes to resolve each issue. |
Auto-Triage SummaryDecisions Made
ReasoningAll four FIX_NOW items are mechanical cleanup tasks directly related to the PR's changes:
These are in-scope incomplete work - the PR established new patterns but didn't finish applying them everywhere. All fixes are mechanical (no design decisions needed). Status
|
This commit fixes four related issues from PR review: 1. test_runner.ex: Changed parameter from 'mode:' to 'data_mode:' to match the Agent.start_link/1 API. Removed the mode parameter entirely since TestRunner should use the default schema mode. 2. test_runner.ex: Removed outdated documentation that referenced ':structured/:text' modes which no longer exist. The agent now uses ':schema/:explore' data modes. 3. README.md: Removed all references to the '--structured' flag that no longer exists: - Removed '--structured' example from quick start section - Removed entire 'Generation Modes' section - Updated test runner examples to remove mode parameter - Updated example output 4. cli.ex: Added validation to reject unknown flags and prevent silent failures when users follow stale documentation using '--structured'. Changes are minimal and focused on alignment with the refactored Agent API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
SummaryAll four issues from the PR review have been fixed in a single commit. Changes Made
Test Results
CommitCommit: All changes have been pushed to the branch. |
PR Review: feat(demo): Add explore mode for schema discoverySummaryWell-structured PR that adds explore mode to the demo app, allowing LLMs to discover data schemas via introspection operations. The implementation includes a refactored agentic loop that cleanly tracks execution state. The PR also removes the outdated What's Good
Issues (Must Fix)
Suggestions (Optional)
SecurityNo concerns. The changes are focused on the demo app and don't introduce new attack surfaces. The Documentation
VerdictRequest Changes - The outdated text/structured mode references in demo/README.md should be fixed before merge for documentation consistency. This is a mechanical fix following the same cleanup pattern the PR already establishes for mode terminology. |
|
@claude please fix these issues from PR review: Issue 1: Outdated structured/text mode references in README.mdLocation:
Please fix in a SINGLE commit with minimal changes. |
Auto-Triage Summary (Cycle 2 of 3)Decisions Made
ReasoningThis is a mechanical documentation cleanup that is directly in-scope:
Status
The review suggested one nice-to-have improvement (making |
- Remove outdated text about 'text mode vs structured mode' (line 161) - Remove bullet points about structured/text mode under Generate step (lines 208-209) - The agent now uses a single generation approach with data modes (schema/explore)
Fix SummaryFixed outdated documentation references in demo/README.md: ✅ Changes made:
✅ Verification:
The documentation now accurately reflects that the agent uses a single generation approach with data modes rather than separate structured/text modes. |
PR Review: feat(demo): Add explore mode for schema discoverySummaryThis PR adds an "explore mode" to the demo app where LLMs must discover data structures via introspection ( What's Good
Issues (Must Fix)None. The implementation is complete and consistent. Suggestions (Optional)
SecurityNo concerns. The demo app only operates on in-memory sample data, and the sandbox limits (timeout, memory) remain in place. Documentation
VerdictApprove - This is a well-implemented feature that meets all acceptance criteria. The code is clean, the agentic loop is properly bounded, tests pass, and documentation is updated. The |
Auto-Triage Summary (Cycle 2 of 3 - Final)Review ResultThe third review shows Approve verdict with no "Must Fix" issues. Decisions Made
ReasoningBoth suggestions are truly optional improvements:
The PR successfully implements all acceptance criteria from issue #91:
Status
PR is ready to merge. Adding |
Summary
Adds an "explore mode" to the demo app where the LLM discovers data structure via introspection operations before writing queries.
--exploreCLI flag to start in explore mode/mode,/mode schema,/mode explorecommands for runtime switchingkeysandtypeofoperations to discover schemaAlso includes:
Closes #91
Test plan
./ptc_demo --explorestarts in explore mode/modeshows current mode/mode schemaand/mode exploreswitch modes/resetreturns to schema mode🤖 Generated with Claude Code