feat(ai): add telemetry, error explanation, contract optimization, and security training - #56
Merged
Nanle-code merged 1 commit intoJul 27, 2026
Conversation
…d security training Implements four AI feature issues as a cohesive set under `starforge ai`: - Usage telemetry (#482): per-call tracking of provider/model, tokens, cost, latency percentiles, and error rates, stored locally with an opt-out and `ai telemetry show|cost|status|clear` reporting commands. - Error explanation (#511): `ai explain-error` classifies compilation, runtime, network, configuration, and deployment errors and returns plain- language explanations, root cause, fixes, and troubleshooting steps. - Contract optimization (#497): `ai optimize` adds before/after gas-weight comparison, a diff view, and a public-function safety check before writing optimized output, gated behind confirmation. - Security training (#576): `ai security-training` ships an offline lesson and quiz curriculum with per-topic progress tracking and personalized "what to study next" recommendations. Also fixes several build breaks unrelated to these features but blocking compilation of this branch: missing `UpgradeSimulationResult`/`AuthEntry` types and a missing `horizon::fetch_account_signers` implementation from an earlier upgrade-command commit, a stray `#[command(subcommand)]` on the `Ai` CLI variant, a missing `anyhow::Context` import, and an async-openai 0.14 API mismatch (message construction, client type, response content handling) in the AI command module. Closes #482, #511, #497, #576 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
…
Implements four AI feature issues as a cohesive set under
starforge ai:ai telemetry show|cost|status|clearreporting commands.ai explain-errorclassifies compilation, runtime, network, configuration, and deployment errors and returns plain- language explanations, root cause, fixes, and troubleshooting steps.ai optimizeadds before/after gas-weight comparison, a diff view, and a public-function safety check before writing optimized output, gated behind confirmation.ai security-trainingships an offline lesson and quiz curriculum with per-topic progress tracking and personalized "what to study next" recommendations.Also fixes several build breaks unrelated to these features but blocking compilation of this branch: missing
UpgradeSimulationResult/AuthEntrytypes and a missinghorizon::fetch_account_signersimplementation from an earlier upgrade-command commit, a stray#[command(subcommand)]on theAiCLI variant, a missinganyhow::Contextimport, and an async-openai 0.14 API mismatch (message construction, client type, response content handling) in the AI command module.Closes #482
Closes #511
Closes #497
Closes #576
Description
Brief description of what this PR does and why.
Closes #(issue number)
Type of Change
Changes Made
Testing
How has this been tested?
Describe the tests you ran and how to reproduce them.
Test Coverage
Describe what scenarios have been tested:
Code Quality Checklist
cargo fmt)cargo clippy -- -D warnings)Breaking Changes
If checked, describe the breaking changes and migration path:
Documentation
Screenshots (if applicable)
Add screenshots or GIFs for UI changes.
Additional Context
Add any other context about the PR here.