-
Notifications
You must be signed in to change notification settings - Fork 5
feat: success pattern tracking with model routing integration (t102.3) #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Enhanced pattern-tracker-helper.sh with recommend, export, and report commands - Supervisor now stores SUCCESS_PATTERN/FAILURE_PATTERN types (was WORKING_SOLUTION/FAILED_APPROACH) enabling pattern-tracker to find and analyze supervisor-generated patterns - Supervisor patterns now include model tier, duration, and retry count metadata - /route command now consults pattern history for data-driven model recommendations - /patterns command supports report, recommend, and export subcommands - Export supports JSON (via sqlite3 -json) and CSV formats - Pattern analysis queries both dedicated and supervisor-generated pattern types - Updated memory README with comprehensive pattern tracking documentation Decision: kept backward compatibility by querying both old types (WORKING_SOLUTION, FAILED_APPROACH, ERROR_FIX) and new types (SUCCESS_PATTERN, FAILURE_PATTERN) so existing pattern data remains accessible.
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant upgrade to the system's pattern tracking and model routing capabilities. By enhancing the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Gemini encountered an error creating the summary. You can try again by commenting |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ✏️ Tip: You can disable in-progress messages and the fortune message in your review settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1 similar comment
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ✏️ Tip: You can disable in-progress messages and the fortune message in your review settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
WalkthroughThis PR expands the pattern tracking system with SQL-backed analysis, new querying capabilities, and model-tier metadata enrichment. The pattern-tracker-helper script gains three new commands (recommend, export, report) and dynamic SQL filtering logic. Documentation updates reflect new pattern-aware routing flows. Pattern storage is enhanced with model tier, duration, and retry metadata across both supervisor and tracking helpers. Changes
Sequence Diagram(s)sequenceDiagram
participant Supervisor as Supervisor Helper
participant PatternDB as Pattern Tracker DB
participant Router as Route Command
participant Recommender as Recommend Command
rect rgba(100, 200, 100, 0.5)
Note over Supervisor,PatternDB: Pattern Recording Flow
Supervisor->>PatternDB: store_failure_pattern(task, model_tier, duration, retries)
Supervisor->>PatternDB: store_success_pattern(task, model_tier, duration, retries)
PatternDB->>PatternDB: Enrich with metadata tags
end
rect rgba(100, 150, 200, 0.5)
Note over Router,PatternDB: Pattern-Based Routing Flow
Router->>PatternDB: Query pattern history (WHERE clauses by task_type, model)
PatternDB-->>Router: Return success/failure pattern data
Router->>Router: Evaluate patterns vs routing rules
Router->>Router: Resolve conflicts & compute confidence
Router-->>Router: Recommend model tier
end
rect rgba(200, 150, 100, 0.5)
Note over Recommender,PatternDB: Pattern Recommendation Flow
Recommender->>PatternDB: analyze() with task-type filtering
PatternDB-->>Recommender: Pattern analysis with success rates
Recommender->>Recommender: Compute model tier recommendations
Recommender-->>Recommender: Present recommendation with context notes
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.agents/scripts/pattern-tracker-helper.sh (1)
81-98:⚠️ Potential issue | 🟡 MinorMissing
shift 2guard — if a flag like--outcomeis the last argument with no value,$2is unset andshift 2will fail underset -u.With
set -euo pipefail(line 18), accessing$2when only one argument remains triggers an unbound variable error, andshift 2will also fail. This applies to all flag-parsingcasebranches acrosscmd_record,cmd_analyze,cmd_recommend, andcmd_export.This is an edge case (user error), but under
set -uit produces a confusing "unbound variable" traceback rather than a helpful error message.🛡️ Example guard pattern
--outcome) if [[ $# -lt 2 ]]; then log_error "--outcome requires a value" return 1 fi outcome="$2"; shift 2 ;;
🤖 Fix all issues with AI agents
In @.agents/scripts/commands/patterns.md:
- Line 54: The "Available commands: suggest, recommend, analyze, stats, report,
export" list omits the `record` command shown in the example; update that
command list to include `record` so it matches the example usage (i.e., add
`record` to the string "Available commands: ...") and verify any surrounding
documentation references to the same command list (the example block
demonstrating `record`) are consistent.
In @.agents/scripts/commands/route.md:
- Around line 14-18: The documentation invokes recommend with free-form
"$ARGUMENTS" but cmd_recommend in pattern-tracker-helper.sh only filters by
--task-type (positional task_desc is only displayed), so update the call or
docs: either modify the script to extract a task type from ARGUMENTS before
calling recommend (e.g., derive and pass --task-type from ARGUMENTS) or change
the example invocation to pass an explicit task type variable instead of raw
free text; reference cmd_recommend, pattern-tracker-helper.sh, recommend,
ARGUMENTS, and task_desc when making the change and add a short clarifying
comment explaining whether global stats are acceptable or a task-type must be
provided.
In @.agents/scripts/pattern-tracker-helper.sh:
- Around line 29-34: Remove the duplicated comment immediately above the
PATTERN_TYPES declaration: keep a single descriptive comment that references
PATTERN_TYPES_SQL and PATTERN_TYPES, delete the redundant repeated line so the
block has only one comment followed by the
PATTERN_TYPES="'SUCCESS_PATTERN','FAILURE_PATTERN','WORKING_SOLUTION','FAILED_APPROACH','ERROR_FIX'"
and readonly PATTERN_TYPES; no other code changes are needed.
- Around line 396-411: The tie-breaker currently uses an always-true check ([[
"$total" -gt 0 ]]) so equal rates always pick the last model; update the logic
to prefer the model with the larger sample count by comparing total to a tracked
best_total (e.g., change the tie condition to [[ "$rate" -eq "$best_rate" ]] &&
[[ "$total" -gt "$best_total" ]]) and when you set best_rate and best_model also
set best_total=$total; also add initialization for best_rate (e.g., -1) and
best_total (0) before the loop that iterates model_tier so the comparisons work
correctly.
- Around line 531-536: The sqlite3 -json usage in the case block (where local
query=... and sqlite3 -json "$MEMORY_DB" "$query") is not safe on older SQLite
versions; add a compatibility check at script start or before this branch that
detects whether sqlite3 supports -json (e.g., parse sqlite3 --version or try a
small test query) and if not, run sqlite3 without -json and pipe output through
jq (or a small shell-to-JSON formatter) to produce the same JSON shape, and log
a clear warning when falling back; update the case branch to call a helper
function (e.g., ensure_sqlite_json or format_query_json) that encapsulates the
detection and fallback so the SELECT query variable and MEMORY_DB usage remain
unchanged while guaranteeing consistent JSON output and visible logs on
fallback.
In @.agents/scripts/supervisor-helper.sh:
- Around line 7707-7710: Remove the unused local variable duration_info from the
declaration to satisfy ShellCheck SC2034; update the local line in
.agents/scripts/supervisor-helper.sh (where task_model, duration_info, retries
are declared) to only declare the used variables (task_model and retries) and
then re-run ShellCheck to ensure no remaining violations.
🧹 Nitpick comments (5)
.agents/scripts/supervisor-helper.sh (1)
7652-7677: Consider adding duration/retry metadata to failure patterns for parity with success records.Success patterns now carry duration/retries; failures only add model tier. If reports/recommendations expect those fields across outcomes, the missing data can skew comparisons. Suggest mirroring the duration/retry enrichment (or explicitly documenting the asymmetry).
.agents/scripts/pattern-tracker-helper.sh (4)
21-27:readonly SCRIPT_DIRdeclared afterSCRIPT_DIRis already used on line 22.
SCRIPT_DIRis assigned on line 21 and immediately used on line 22 to sourceshared-constants.sh. Thereadonlyon line 25 comes after the value has already been consumed. While this works, ifshared-constants.shorinit_log_file(line 23) were to reassignSCRIPT_DIR, the readonly wouldn't protect against it. Consider combining assignment and readonly, or moving the readonly immediately after assignment on line 21.
60-66:sql_escape()does not escape LIKE wildcards%and_.This function is used to build
LIKE '%${escaped_value}%'clauses incmd_analyze,cmd_recommend,cmd_report, and_show_model_hint. If a user-supplied value (e.g.,task_type) contains%or_, the LIKE pattern will match unintended rows. The task-type validation is a soft warning (line 120), so arbitrary values flow through unchecked.Risk is low in practice (inputs are typically alphanumeric slugs), but for a zero-technical-debt posture, consider escaping LIKE metacharacters or using exact-match (
=) where appropriate.🛡️ Proposed enhancement
sql_escape() { local val="$1" - echo "${val//\'/\'\'}" + # Escape single quotes for SQL strings + val="${val//\'/\'\'}" + # Escape LIKE wildcards when used in LIKE patterns + val="${val//%/\\%}" + val="${val//_/\\_}" + echo "$val" }Note: If you add this, the LIKE clauses would need
ESCAPE '\'appended, e.g.,LIKE '%value%' ESCAPE '\'. Alternatively, keepsql_escapefocused on quotes and add a separatesql_escape_like().
186-186:ensure_db || return 0silently succeeds when the DB is missing.In
cmd_analyze(line 186),cmd_stats(line 442), andcmd_report(line 554), a missing database causes the command to return 0 (success). This is a deliberate design choice for a graceful no-op, but incmd_export(line 526) it returns 1 — the inconsistency could surprise callers.If the intent is that
analyze,stats, andreportare informational (no DB = nothing to show), whileexportis a data pipeline command (no DB = error), the inconsistency is fine but worth a brief inline comment explaining the rationale for discoverability.
673-716:_show_model_hintlargely duplicates the core logic ofcmd_recommend.Both iterate
VALID_MODELS, query success/failure counts per tier, and pick the best model by rate. The only difference is_show_model_hintrequiresm_total > 2andcmd_recommendrequiresm_total > 0. Consider extracting the shared query-and-rank logic into a helper to keep them in sync and reduce the maintenance surface.
| --task-type bugfix --model sonnet \ | ||
| --description "Structured debugging approach found root cause quickly" | ||
|
|
||
| Available commands: suggest, recommend, analyze, stats, report, export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Command list may be incomplete.
The available commands list mentions suggest, recommend, analyze, stats, report, export, but the example above (lines 50-52) demonstrates the record command. Should record be included in the available commands list for completeness?
📝 Suggested fix to include record command
-Available commands: suggest, recommend, analyze, stats, report, export
+Available commands: record, suggest, recommend, analyze, stats, report, export📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Available commands: suggest, recommend, analyze, stats, report, export | |
| Available commands: record, suggest, recommend, analyze, stats, report, export |
🤖 Prompt for AI Agents
In @.agents/scripts/commands/patterns.md at line 54, The "Available commands:
suggest, recommend, analyze, stats, report, export" list omits the `record`
command shown in the example; update that command list to include `record` so it
matches the example usage (i.e., add `record` to the string "Available commands:
...") and verify any surrounding documentation references to the same command
list (the example block demonstrating `record`) are consistent.
| 1. First, check pattern history for data-driven insights: | ||
|
|
||
| 2. Analyze the task description against the routing rules: | ||
| ```bash | ||
| ~/.aidevops/agents/scripts/pattern-tracker-helper.sh recommend "$ARGUMENTS" | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommend is invoked with the raw task description, but the command only filters by --task-type, not free text.
cmd_recommend in pattern-tracker-helper.sh uses --task-type for SQL filtering. Positional arguments are stored in task_desc but are only displayed — they don't influence the query. So invoking recommend "$ARGUMENTS" (where $ARGUMENTS is a free-form task description like "refactor the auth middleware") will show unfiltered global model stats, not task-specific recommendations.
If the intent is task-type-specific routing, the agent would need to extract a task type from $ARGUMENTS first. If global stats are acceptable here, consider adding a comment clarifying that.
🤖 Prompt for AI Agents
In @.agents/scripts/commands/route.md around lines 14 - 18, The documentation
invokes recommend with free-form "$ARGUMENTS" but cmd_recommend in
pattern-tracker-helper.sh only filters by --task-type (positional task_desc is
only displayed), so update the call or docs: either modify the script to extract
a task type from ARGUMENTS before calling recommend (e.g., derive and pass
--task-type from ARGUMENTS) or change the example invocation to pass an explicit
task type variable instead of raw free text; reference cmd_recommend,
pattern-tracker-helper.sh, recommend, ARGUMENTS, and task_desc when making the
change and add a short clarifying comment explaining whether global stats are
acceptable or a task-type must be provided.
| # All pattern-related memory types (dedicated + supervisor-generated) | ||
| # All pattern-related memory types (dedicated + supervisor-generated) | ||
| # Use via: local types_sql="$PATTERN_TYPES_SQL" then sqlite3 ... "$types_sql" ... | ||
| # Or inline in single-line sqlite3 calls where variable expansion works correctly | ||
| PATTERN_TYPES="'SUCCESS_PATTERN','FAILURE_PATTERN','WORKING_SOLUTION','FAILED_APPROACH','ERROR_FIX'" | ||
| readonly PATTERN_TYPES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate comment on lines 29–30.
Lines 29 and 30 are identical comments. One should be removed.
✂️ Proposed fix
-# All pattern-related memory types (dedicated + supervisor-generated)
# All pattern-related memory types (dedicated + supervisor-generated)
# Use via: local types_sql="$PATTERN_TYPES_SQL" then sqlite3 ... "$types_sql" ...📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # All pattern-related memory types (dedicated + supervisor-generated) | |
| # All pattern-related memory types (dedicated + supervisor-generated) | |
| # Use via: local types_sql="$PATTERN_TYPES_SQL" then sqlite3 ... "$types_sql" ... | |
| # Or inline in single-line sqlite3 calls where variable expansion works correctly | |
| PATTERN_TYPES="'SUCCESS_PATTERN','FAILURE_PATTERN','WORKING_SOLUTION','FAILED_APPROACH','ERROR_FIX'" | |
| readonly PATTERN_TYPES | |
| # All pattern-related memory types (dedicated + supervisor-generated) | |
| # Use via: local types_sql="$PATTERN_TYPES_SQL" then sqlite3 ... "$types_sql" ... | |
| # Or inline in single-line sqlite3 calls where variable expansion works correctly | |
| PATTERN_TYPES="'SUCCESS_PATTERN','FAILURE_PATTERN','WORKING_SOLUTION','FAILED_APPROACH','ERROR_FIX'" | |
| readonly PATTERN_TYPES |
🤖 Prompt for AI Agents
In @.agents/scripts/pattern-tracker-helper.sh around lines 29 - 34, Remove the
duplicated comment immediately above the PATTERN_TYPES declaration: keep a
single descriptive comment that references PATTERN_TYPES_SQL and PATTERN_TYPES,
delete the redundant repeated line so the block has only one comment followed by
the
PATTERN_TYPES="'SUCCESS_PATTERN','FAILURE_PATTERN','WORKING_SOLUTION','FAILED_APPROACH','ERROR_FIX'"
and readonly PATTERN_TYPES; no other code changes are needed.
| local total=$((successes + failures)) | ||
| if [[ "$total" -gt 0 ]]; then | ||
| has_data=true | ||
| local rate | ||
| rate=$(( (successes * 100) / total )) | ||
| printf " %-10s %8d %8d %9d%%\n" "$model_tier" "$successes" "$failures" "$rate" | ||
|
|
||
| # Track best model (prefer higher success rate, break ties with more data) | ||
| if [[ "$rate" -gt "$best_rate" ]] || { [[ "$rate" -eq "$best_rate" ]] && [[ "$total" -gt 0 ]]; }; then | ||
| best_rate=$rate | ||
| best_model=$model_tier | ||
| fi | ||
| else | ||
| echo " (no matching failure patterns)" | ||
| printf " %-10s %8s %8s %10s\n" "$model_tier" "-" "-" "no data" | ||
| fi | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tie-breaking logic in cmd_recommend is a no-op — always picks the last model at a given rate.
On line 404, the tie-breaker condition is [[ "$total" -gt 0 ]], but we're already inside the if [[ "$total" -gt 0 ]] block (line 397), so this is always true. The result: when two models have the same success rate, the one iterated last wins regardless of sample count. The comment on line 403 says "prefer … more data," but that's not what the code does.
🐛 Proposed fix — break ties by sample count
- # Track best model (prefer higher success rate, break ties with more data)
- if [[ "$rate" -gt "$best_rate" ]] || { [[ "$rate" -eq "$best_rate" ]] && [[ "$total" -gt 0 ]]; }; then
- best_rate=$rate
- best_model=$model_tier
+ # Track best model (prefer higher success rate, break ties with more data)
+ if [[ "$rate" -gt "$best_rate" ]] || { [[ "$rate" -eq "$best_rate" ]] && [[ "$total" -gt "$best_total" ]]; }; then
+ best_rate=$rate
+ best_model=$model_tier
+ best_total=$total
fiAnd initialize on line 387:
- local best_model="" best_rate=0 has_data=false
+ local best_model="" best_rate=0 best_total=0 has_data=false🤖 Prompt for AI Agents
In @.agents/scripts/pattern-tracker-helper.sh around lines 396 - 411, The
tie-breaker currently uses an always-true check ([[ "$total" -gt 0 ]]) so equal
rates always pick the last model; update the logic to prefer the model with the
larger sample count by comparing total to a tracked best_total (e.g., change the
tie condition to [[ "$rate" -eq "$best_rate" ]] && [[ "$total" -gt "$best_total"
]]) and when you set best_rate and best_model also set best_total=$total; also
add initialization for best_rate (e.g., -1) and best_total (0) before the loop
that iterates model_tier so the comparisons work correctly.
| case "$format" in | ||
| json) | ||
| # Use sqlite3 -json for proper JSON output | ||
| local query="SELECT l.id, l.type, l.content, l.tags, l.confidence, l.created_at, COALESCE(a.access_count, 0) as access_count FROM learnings l LEFT JOIN learning_access a ON l.id = a.id WHERE l.type IN ($types_sql) ORDER BY l.created_at DESC;" | ||
| sqlite3 -json "$MEMORY_DB" "$query" 2>/dev/null || echo "[]" | ||
| ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
SQLite 3.33.0 -json flag introduction minimum version requirement
💡 Result:
The sqlite3 command-line shell’s -json flag (sets output mode to JSON) was introduced in SQLite 3.33.0 (released 2020-08-14). So the minimum required version is SQLite/sqlite3 3.33.0. [1] [2]
Note: This is a CLI (shell) feature, not a SQLite library/API requirement. [1]
Sources:
[1] (sqlite.org)
[2] (sqlite.org)
Citations:
🏁 Script executed:
# Check the script around the mentioned lines and full context
head -550 .agents/scripts/pattern-tracker-helper.sh | tail -50Repository: marcusquinn/aidevops
Length of output: 2000
🏁 Script executed:
# Also get broader context about the function
grep -n "case.*format" .agents/scripts/pattern-tracker-helper.sh -A 30 | head -100Repository: marcusquinn/aidevops
Length of output: 1497
🏁 Script executed:
# Check if there's any version checking in the script
grep -n "sqlite3.*version\|version.*sqlite\|3\.33\|SQLITE" .agents/scripts/pattern-tracker-helper.shRepository: marcusquinn/aidevops
Length of output: 46
🏁 Script executed:
# Check for other sqlite3 usage patterns in the script
grep -n "sqlite3" .agents/scripts/pattern-tracker-helper.shRepository: marcusquinn/aidevops
Length of output: 4318
🏁 Script executed:
# Look for any version check or compatibility handling in the script
grep -n "version\|compatibility\|check" .agents/scripts/pattern-tracker-helper.sh | head -20Repository: marcusquinn/aidevops
Length of output: 429
Add version compatibility check for sqlite3 -json or implement jq-based fallback.
The -json flag requires SQLite ≥ 3.33.0 (released 2020-08-14). Systems running older versions (e.g., Ubuntu 18.04/20.04 stock packages) will fail silently, with the 2>/dev/null || echo "[]" fallback masking the error and producing an empty array indistinguishable from actual empty results. This violates the DevOps requirements for clear logging and reliability.
Implement either:
- A version check at script initialization that validates SQLite version and falls back to jq-based JSON conversion if
-jsonis unavailable - Use
jqto manually format standard query output as JSON, ensuring compatibility across SQLite versions
This aligns with the broader error recovery and logging requirements for automation scripts.
🤖 Prompt for AI Agents
In @.agents/scripts/pattern-tracker-helper.sh around lines 531 - 536, The
sqlite3 -json usage in the case block (where local query=... and sqlite3 -json
"$MEMORY_DB" "$query") is not safe on older SQLite versions; add a compatibility
check at script start or before this branch that detects whether sqlite3
supports -json (e.g., parse sqlite3 --version or try a small test query) and if
not, run sqlite3 without -json and pipe output through jq (or a small
shell-to-JSON formatter) to produce the same JSON shape, and log a clear warning
when falling back; update the case branch to call a helper function (e.g.,
ensure_sqlite_json or format_query_json) that encapsulates the detection and
fallback so the SELECT query variable and MEMORY_DB usage remain unchanged while
guaranteeing consistent JSON output and visible logs on fallback.
| local task_model duration_info retries | ||
| task_model=$(db "$SUPERVISOR_DB" "SELECT model FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "") | ||
| retries=$(db "$SUPERVISOR_DB" "SELECT retries FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "0") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused duration_info to keep ShellCheck clean.
duration_info is declared but never used, which will trigger ShellCheck (SC2034) in this script.
🧹 Proposed fix
- local task_model duration_info retries
+ local task_model retriesAs per coding guidelines, "Run ShellCheck with zero violations on all scripts in .agents/scripts/".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| local task_model duration_info retries | |
| task_model=$(db "$SUPERVISOR_DB" "SELECT model FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "") | |
| retries=$(db "$SUPERVISOR_DB" "SELECT retries FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "0") | |
| local task_model retries | |
| task_model=$(db "$SUPERVISOR_DB" "SELECT model FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "") | |
| retries=$(db "$SUPERVISOR_DB" "SELECT retries FROM tasks WHERE id = '$escaped_id';" 2>/dev/null || echo "0") | |
🤖 Prompt for AI Agents
In @.agents/scripts/supervisor-helper.sh around lines 7707 - 7710, Remove the
unused local variable duration_info from the declaration to satisfy ShellCheck
SC2034; update the local line in .agents/scripts/supervisor-helper.sh (where
task_model, duration_info, retries are declared) to only declare the used
variables (task_model and retries) and then re-run ShellCheck to ensure no
remaining violations.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Mon Feb 9 16:30:18 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |



Summary
pattern-tracker-helper.shwithrecommend,export, andreportcommands for data-driven model routing decisionsstore_success_pattern/store_failure_patternto use dedicatedSUCCESS_PATTERN/FAILURE_PATTERNmemory types with model tier, duration, and retry metadata/routecommand with pattern history so model recommendations factor in historical success ratesChanges
pattern-tracker-helper.sh (major enhancement)
recommendcommand: Queries pattern history per model tier, calculates success rates, recommends the best-performing modelexportcommand: Exports all patterns as JSON (sqlite3 -json) or CSV for external analysisreportcommand: Generates comprehensive report with date range, success rates, top failure patterns, model performance table, and recent patternssuggestnow includes model routing hints based on pattern dataSUCCESS_PATTERN,FAILURE_PATTERN) and supervisor-generated types (WORKING_SOLUTION,FAILED_APPROACH,ERROR_FIX) for complete coverage--task-id,--duration,--retriesflags torecordcommandsupervisor-helper.sh (pattern type alignment)
store_success_pattern()now stores asSUCCESS_PATTERN(wasWORKING_SOLUTION)store_failure_pattern()now stores asFAILURE_PATTERN(wasFAILED_APPROACH/ERROR_FIX)store_success_pattern()calculates task duration fromstarted_at/completed_attimestamps[task:type] description [model:tier] [duration:Ns] [retries:N]/route command (pattern-aware routing)
pattern-tracker-helper.sh recommendbefore applying static routing rules/patterns command (expanded)
report,recommend, and standardsuggestsubcommandsmemory/README.md
Testing
bash -nSummary by CodeRabbit
Release Notes
New Features
Documentation