Skip to content

t1095: Extend pattern tracker schema with strategy, quality, failure_mode, and token columns#1629

Merged
marcusquinn merged 3 commits intomainfrom
feature/t1095
Feb 18, 2026
Merged

t1095: Extend pattern tracker schema with strategy, quality, failure_mode, and token columns#1629
marcusquinn merged 3 commits intomainfrom
feature/t1095

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 18, 2026

Summary

Extends the pattern tracker schema with 5 new structured columns for richer analytics on autonomous task execution patterns.

New columns (in pattern_metadata companion table)

  • strategy: normal | prompt-repeat | escalated -- how the task was dispatched
  • quality: ci-pass-first-try | ci-pass-after-fix | needs-human -- CI outcome quality
  • failure_mode: hallucination | context-miss | incomplete | wrong-file | timeout -- failure classification
  • tokens_in: Input token count per task
  • tokens_out: Output token count per task

Design decisions

  • Used a companion table (pattern_metadata) rather than altering the FTS5 learnings table (FTS5 does not support ALTER TABLE ADD COLUMN)
  • All new fields are optional -- existing callers without new flags continue to work unchanged
  • Migration backfills existing pattern records with strategy=normal, others NULL
  • Migration is idempotent -- safe to run multiple times
  • CHECK constraints enforce valid enum values at the database level

Changes

  • .agents/scripts/memory/_common.sh: Added pattern_metadata table to init_db() and migrate_db() with backfill
  • .agents/scripts/pattern-tracker-helper.sh: Updated cmd_record (new flags + validation), cmd_stats (metadata breakdown), cmd_export (new columns in JSON/CSV), cmd_report (extended metadata section), cmd_help (new options + examples)

Testing

  • ShellCheck: zero violations on both modified files
  • Migration: 823 existing records backfilled successfully
  • Recording: new fields stored correctly with all combinations
  • Backward compatibility: recording without new fields works (defaults to strategy=normal)
  • Validation: invalid enum values, non-integer tokens rejected with clear errors
  • Idempotency: re-running migration produces no duplicates or errors
  • Export: JSON and CSV include new columns with proper null handling

Ref #1620

Add companion table for pattern records with columns: strategy
(normal/prompt-repeat/escalated), quality (ci-pass-first-try/ci-pass-after-fix/
needs-human), failure_mode (hallucination/context-miss/incomplete/wrong-file/
timeout), tokens_in, tokens_out. Migration backfills existing records with
strategy=normal. Table created in both init_db and migrate_db for new and
existing databases.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t1095

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 20 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 02:34:02 UTC 2026: Code review monitoring started
Wed Feb 18 02:34:03 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 20

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 20
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 02:34:05 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

…e_mode, tokens (t1095)

Update cmd_record to accept --strategy, --quality, --failure-mode, --tokens-in,
--tokens-out flags with validation. Store extended metadata in pattern_metadata
companion table. Update cmd_stats, cmd_export, cmd_report to surface the new
fields. Update help text with new options and examples. All changes are
backward-compatible — existing callers without new flags continue to work.
@marcusquinn marcusquinn marked this pull request as ready for review February 18, 2026 02:39
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 significantly enhances the pattern tracking system by introducing a dedicated schema for extended pattern metadata. This allows for the capture of more granular details such as the strategy used, quality of outcome, specific failure modes, and token usage for each pattern. These additions provide a more comprehensive understanding of AI agent performance and behavior, enabling deeper analysis and more informed decision-making.

Highlights

  • New pattern_metadata table introduced: A new SQLite table, pattern_metadata, has been added to the memory database. This table stores extended attributes for patterns, including strategy, quality, failure_mode, tokens_in, and tokens_out, linked by ID to existing pattern records.
  • Enhanced Pattern Recording: The pattern-tracker-helper.sh record command now accepts new arguments (--strategy, --quality, --failure-mode, --tokens-in, --tokens-out) to capture more detailed metadata about each recorded pattern. Robust validation has been added for these new fields.
  • Extended Reporting and Export Capabilities: The pattern-tracker-helper.sh stats, report, and export commands have been updated to include and display the newly introduced pattern metadata. This provides richer insights into pattern characteristics and model performance.
  • Database Migration and Backfill: The _common.sh script now includes logic to automatically create the pattern_metadata table upon database initialization or migration. It also backfills existing pattern records with a default 'normal' strategy into the new metadata table.
Changelog
  • .agents/scripts/memory/_common.sh
    • Added logic to create the pattern_metadata table if it does not exist, including columns for strategy, quality, failure_mode, tokens_in, and tokens_out.
    • Implemented a backfill mechanism to populate the new pattern_metadata table with existing pattern IDs, setting a default 'normal' strategy.
    • Included the CREATE TABLE IF NOT EXISTS pattern_metadata statement in the initial database setup.
  • .agents/scripts/pattern-tracker-helper.sh
    • Refactored log_info, log_success, log_warn, and log_error functions to use multi-line definitions for improved readability.
    • Updated cmd_record to accept new command-line arguments: --strategy, --quality, --failure-mode, --tokens-in, and --tokens_out.
    • Added validation for the new strategy, quality, and failure_mode parameters against predefined allowed values.
    • Implemented validation to ensure tokens_in and tokens_out are positive integers.
    • Modified cmd_record to store the new extended metadata in the pattern_metadata table after recording the main pattern.
    • Enhanced cmd_stats to display statistics and breakdowns for the new strategy, quality, failure_mode, and token usage from the pattern_metadata table.
    • Updated cmd_export to include the new metadata columns (strategy, quality, failure_mode, tokens_in, tokens_out) in JSON and CSV exports by joining with pattern_metadata.
    • Extended cmd_report to include a section detailing the distribution of strategies, qualities, and failure modes.
    • Updated cmd_help to list the new --strategy, --quality, --failure-mode, --tokens-in, and --tokens-out options for the record command.
    • Added new examples to the cmd_help output demonstrating how to use the extended metadata options when recording patterns.
Activity
  • The pull request is marked as 'WIP - incremental commits', indicating ongoing development and iterative changes.
  • The changes are directly related to issue t1094: Unified model performance scoring #1620, suggesting this PR addresses a specific feature request or bug report.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 22 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 02:40:13 UTC 2026: Code review monitoring started
Wed Feb 18 02:40:13 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 22

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 22
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 02:40:16 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully extends the pattern tracker schema with new columns for strategy, quality, failure mode, and token counts. The changes include creating a companion table pattern_metadata, updating the cmd_record function to handle these new fields with appropriate validation, and enhancing cmd_stats, cmd_export, and cmd_report to utilize and display this new data. The cmd_help output and examples have also been updated for clarity. Overall, the implementation is robust, including idempotency for migrations and validation for new inputs. However, there are a few areas for improvement regarding code maintainability and robustness.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 22 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 02:57:19 UTC 2026: Code review monitoring started
Wed Feb 18 02:57:20 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 22

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 22
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 02:57:23 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit ffa3bc7 into main Feb 18, 2026
15 checks passed
@marcusquinn marcusquinn deleted the feature/t1095 branch February 18, 2026 03:15
marcusquinn added a commit that referenced this pull request Feb 18, 2026
…d t1094.1 (t1107)

All t1094 deliverables confirmed implemented:
- Prompt strategy tracking → t1095 (pr:#1629)
- Output quality gradient + failure categorization → t1096 (pr:#1632)
- Token usage → t1095 (pr:#1629)
- A/B comparison → t1098+t1099 (pr:#1637, pr:#1634)
- Prompt-repeat strategy → t1097 (pr:#1631)
- Build-agent reference → t1094.1 (pr:#1633)

t1094 parent ready to be marked complete: verified:2026-02-18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant