Skip to content

Improve agent token efficiency for history and activity#35

Merged
unbraind merged 1 commit into
mainfrom
audit/token-output-activity-history-2026-05-20
May 20, 2026
Merged

Improve agent token efficiency for history and activity#35
unbraind merged 1 commit into
mainfrom
audit/token-output-activity-history-2026-05-20

Conversation

@unbraind
Copy link
Copy Markdown
Owner

@unbraind unbraind commented May 20, 2026

Summary

  • Default pm history and pm activity CLI output to compact, token-efficient projections with explicit --full for full JSON Patch audit payloads.
  • Align shell completions, runtime contracts, pm_run activity handling, docs, and regression tests with compact/full projection behavior.
  • Clean semantic vector cache artifacts through pm gc and reject unsupported/disabled dynamic extension long flags.
  • Record full manual audit findings in pm-rnpb and close/release pm-3pbs with full verification evidence.

Verification

  • pnpm build
  • PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/main-loose-options.spec.ts tests/integration/cli.integration.spec.ts tests/unit/contracts-command.spec.ts tests/unit/history-activity-command.spec.ts tests/unit/gc-command.spec.ts tests/integration/mcp-dynamic-package-actions.spec.ts --reporter=dot
  • node scripts/run-tests.mjs coverage
  • pnpm quality:static
  • node scripts/check-secrets.mjs

Notes

  • Manual dogfood, GitHub audit, CI/coverage audit, SDK/extensions audit, code/performance audit, and telemetry/Sentry audit findings were recorded under pm-rnpb without creating duplicate items.
  • Remaining broader follow-ups are already mapped to existing pm items: pm-nbht, pm-5k2w, pm-59gj, pm-gt82, and pm-rnpb.

Summary by Sourcery

Default history and activity outputs to compact, token-efficient projections while adding explicit full-output options, tightening extension flag handling, and extending garbage collection to cover new semantic search artifacts.

New Features:

  • Add compact and full projection modes for history and activity, making compact the default for CLI and MCP tooling.
  • Validate dynamic extension loose options against declared flag metadata, including required and disabled flags, and canonicalize short flags to their long-form keys.
  • Extend garbage collection to clean additional semantic vector cache artifacts, including vectorization status and LanceDB directories.

Bug Fixes:

  • Reject unsupported or disabled dynamic extension flags at parse time with clear usage errors instead of silently accepting them.

Enhancements:

  • Align CLI flag contracts, shell completions, help text, and MCP/SDK contracts with the new compact/full history and activity behavior.
  • Improve loose option parsing for extension commands, including better handling of short flags and nested command paths when resolving flag definitions.

Documentation:

  • Update command and architecture docs with examples that use full history and activity projections and reflect the new projection options.

Tests:

  • Expand unit and integration coverage for history/activity compact vs full projections, extension loose option validation, MCP pm_run activity handling, and garbage collection of vector artifacts.
  • Update release readiness and regression tests to assert the new flag surfaces, schema contracts, and GC behavior.

@unbraind unbraind marked this pull request as ready for review May 20, 2026 22:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Review Change Stack

Warning

Rate limit exceeded

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

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e90e2af9-8b32-4161-98b5-10e1b1abfe86

📥 Commits

Reviewing files that changed from the base of the PR and between 50d8064 and 9288cc8.

📒 Files selected for processing (33)
  • .agents/pm/features/pm-rnpb.toon
  • .agents/pm/history/pm-3pbs.jsonl
  • .agents/pm/history/pm-rnpb.jsonl
  • .agents/pm/issues/pm-3pbs.toon
  • docs/ARCHITECTURE.md
  • docs/COMMANDS.md
  • src/cli/commands/completion.ts
  • src/cli/commands/gc.ts
  • src/cli/commands/history.ts
  • src/cli/extension-command-options.ts
  • src/cli/help-content.ts
  • src/cli/main.ts
  • src/cli/register-list-query.ts
  • src/cli/registration-helpers.ts
  • src/mcp/server.ts
  • src/sdk/cli-contracts.ts
  • tests/integration/cli.integration.spec.ts
  • tests/integration/mcp-dynamic-package-actions.spec.ts
  • tests/integration/release-readiness-runtime.spec.ts
  • tests/unit/beads-command.spec.ts
  • tests/unit/claim-command.spec.ts
  • tests/unit/close-command.spec.ts
  • tests/unit/contracts-command.spec.ts
  • tests/unit/create-command.spec.ts
  • tests/unit/delete-command.spec.ts
  • tests/unit/gc-command.spec.ts
  • tests/unit/get-append-command.spec.ts
  • tests/unit/history-activity-command.spec.ts
  • tests/unit/main-loose-options.spec.ts
  • tests/unit/restore-command.spec.ts
  • tests/unit/test-command.spec.ts
  • tests/unit/todos-extension.spec.ts
  • tests/unit/update-command.spec.ts
📝 Walkthrough

Walkthrough

This PR implements compact-by-default history and activity CLI output with a --full escape hatch, enhances dynamic extension command option validation with short-dash parsing and invocation-aware flag discovery, and extends garbage collection to cover additional search cache artifacts. Nearly all tests updated to use --full when full history entries are required.

Changes

Compact History Projection and Extension Validation

Layer / File(s) Summary
History/activity compact projection interfaces and core behavior
src/cli/commands/history.ts
HistoryCommandOptions adds optional compact flag; HistoryResult extended with compact: boolean and compact_history?: HistoryDiffEntry[]; runHistory conditionally returns compact diffs or full history and derives --diff output accordingly.
CLI command registration and option normalization for compact mode
src/cli/register-list-query.ts, src/cli/registration-helpers.ts, src/mcp/server.ts
register-list-query wires --compact and --full options with mutual-exclusivity validation; normalizeActivityOptions sets compact: false for --full, otherwise true; MCP server derives compact from --full option.
Extension option parsing with short-dash and validation
src/cli/extension-command-options.ts
parseLooseOptionToken extended to parse single-dash options (-x, -x=value); new exported validateLooseCommandOptionsWithFlagDefinitions enforces allowed/required options and rejects disabled; coerceLooseCommandOptionsWithFlagDefinitions canonicalizes alias keys to long-form keys.
Invocation-aware extension flag discovery and CLI validation
src/cli/main.ts
New collectExtensionFlagDefinitionsForInvocation resolves extension flags from command path and non-flag arguments for nested subcommand support; extractCommandScopedOptions validates loose options against available definitions; applied consistently in action wrapper, dynamic command setup, and preAction hook.
CLI contract surfaces for compact/full flags
src/sdk/cli-contracts.ts
TOOL_ACTIVITY_OPTION_CONTRACTS, HISTORY_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS updated to include --compact and --full; PM_TOOL_ACTION_SCHEMA_CONTRACTS["history"] includes compact and full parameters.
Shell completion and help content for new flags
src/cli/commands/completion.ts, src/cli/help-content.ts
Bash, Zsh, Fish completions add --compact and --full for history/activity; help bundles extend examples with --full usage.
Documentation updates for history/activity examples
docs/COMMANDS.md, docs/ARCHITECTURE.md
Updated examples show --full flag usage and compact-by-default behavior.
Test coverage for history/activity compact projection
tests/unit/history-activity-command.spec.ts
Assertions for compact mode response shape, default --json behavior, --full override, and mutual-exclusivity rejection with exit code validation.
Test coverage for option parsing and validation
tests/unit/main-loose-options.spec.ts
Tests short-dash option parsing, validation error handling for unknown/disabled/required options, and short-key canonicalization.
Integration test updates for compact projection
tests/integration/cli.integration.spec.ts, tests/integration/mcp-dynamic-package-actions.spec.ts, tests/integration/release-readiness-runtime.spec.ts
Tests request --full when full history needed; validate compact defaults; test --compact and --full mutual-exclusivity.
Unit test updates requesting full history output
tests/unit/claim-command.spec.ts, tests/unit/close-command.spec.ts, tests/unit/create-command.spec.ts, tests/unit/delete-command.spec.ts, tests/unit/get-append-command.spec.ts, tests/unit/restore-command.spec.ts, tests/unit/test-command.spec.ts, tests/unit/todos-extension.spec.ts, tests/unit/update-command.spec.ts, tests/unit/beads-command.spec.ts, tests/unit/contracts-command.spec.ts
Test helpers updated to use --full flag for accessing complete history entries needed for author/operation/metadata assertions.
Test coverage for contract/schema parity with new flags
tests/unit/contracts-command.spec.ts
New test ensures activity action schema exposes compact and full properties; flag parity expectations updated.

GC Cleanup Artifacts Extension

Layer / File(s) Summary
GC target extension and guidance detection
src/cli/commands/gc.ts
GC_TARGETS for embeddings scope extended to include search/vectorization-status.json and search/lancedb; buildGcGuidance() updated to recognize new paths.
Test coverage for GC cleanup with new artifacts
tests/unit/gc-command.spec.ts
Test fixtures create new search artifacts; expectations expanded across deterministic removal, dry-run, scoped cleanup, and hook dispatch tests.
Integration test updates for GC artifact coverage
tests/integration/cli.integration.spec.ts
GC test setup creates new artifacts; expectations include them in removed list.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Improve agent token efficiency for history and activity' accurately reflects the main change: making CLI history/activity output compact by default for token efficiency.
Description check ✅ Passed The description comprehensively covers all major aspects of the changeset, including compact/full projections, extension flag validation, garbage collection improvements, documentation updates, and verification evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 20, 2026

Reviewer's Guide

Default history/activity outputs to a new compact projection while keeping full JSON Patch payloads opt-in via a --full flag, tighten dynamic extension loose option handling (validation, canonicalization, and nested command resolution), and extend gc to clean semantic vector cache artifacts, with contracts, completions, MCP runtime, docs, and tests aligned to the new behavior.

Sequence diagram for dynamic extension loose option validation and canonicalization

sequenceDiagram
  participant User
  participant PmCli as pm_CLI
  participant Main as main.extractCommandScopedOptions
  participant Reg as ExtensionRegistrations
  participant Flags as collectExtensionFlagDefinitionsForInvocation
  participant Validate as validateLooseCommandOptionsWithFlagDefinitions
  participant Coerce as coerceLooseCommandOptionsWithFlagDefinitions

  User->>PmCli: invoke extension command
  PmCli->>Reg: getActiveExtensionRegistrations
  PmCli->>Flags: collectExtensionFlagDefinitionsForInvocation(commandPath, commandArgs)
  Flags-->>PmCli: extensionFlagDefinitions (including nested commands)

  PmCli->>Main: extractCommandScopedOptions(actionCommand, commandArgs, extensionFlagDefinitions)
  Main->>Main: parseLooseCommandOptions(commandArgs)
  Main->>Validate: validateLooseCommandOptionsWithFlagDefinitions(looseOptions, definitions, commandPath)
  Validate-->>Main: throws PmCliError on unknown/disabled/missing required flags

  Main->>Coerce: coerceLooseCommandOptionsWithFlagDefinitions(looseOptions, definitions)
  Coerce->>Coerce: resolveCanonicalLooseOptionKey(definition)
  Coerce->>Coerce: collectLooseOptionKeys(definition)
  Coerce->>Coerce: coerceLooseOptionValue for canonical key
  Coerce-->>Main: coercedOptions with canonical keys

  Main-->>PmCli: scopedOptions including validated extension flags
  PmCli-->>User: run extension with canonicalized, validated options
Loading

File-Level Changes

Change Details Files
Add strict validation and canonicalization for dynamic extension loose options, including support for required/disabled flags and short aliases, and wire it into command execution.
  • Extend loose option token parsing to support short flags (single dash) with =value, value as next arg, or boolean semantics.
  • Introduce helpers to resolve a canonical option key and human-readable label from flag definitions and use them for error reporting and coercion.
  • Implement validateLooseCommandOptionsWithFlagDefinitions to enforce allowed keys, disabled options, and required options, throwing PmCliError with USAGE exit code on violations.
  • Update coerceLooseCommandOptionsWithFlagDefinitions to canonicalize short/alias keys into the canonical key before coercion and to apply coercion only to the canonical key.
  • Use collectExtensionFlagDefinitionsForInvocation to resolve flag definitions based on nested subcommand paths before parsing, and call validation during option extraction.
  • Add unit and integration tests to cover short-flag parsing, required/disabled/unknown flags, canonicalization, and dynamic extension behavior in CLI integration.
src/cli/extension-command-options.ts
src/cli/main.ts
tests/unit/main-loose-options.spec.ts
tests/integration/cli.integration.spec.ts
Introduce compact vs full projections for history and activity, defaulting CLI/MCP behavior to compact to reduce tokens while keeping full audit data opt-in via --full.
  • Extend history command options and result type to include a compact flag and compact_history projection, and build compact diffs while optionally eliding full history entries.
  • Update CLI registration for history and activity to expose --compact/--full flags, enforce mutual exclusivity with usage errors, and default history CLI calls to compact unless --full is provided.
  • Adjust normalizeActivityOptions and MCP server runAction(activity) so that compact defaults to true unless a full flag is explicitly set, and strip the full flag before calling runActivity.
  • Update contracts schemas, CLI flag contracts, and release-readiness expectations so history/activity tool schemas and required flags include compact/full options.
  • Add unit tests for history/activity commands, contracts, MCP dynamic package actions, and numerous integration/unit specs to assert new JSON shapes, defaults, mutual exclusivity errors, and ordering of top-level keys.
  • Refresh help text and docs (COMMANDS.md, ARCHITECTURE.md, help-content) to demonstrate using --full when verifying history or inspecting full activity payloads, while keeping compact examples as the basic usage.
src/cli/commands/history.ts
src/cli/register-list-query.ts
src/cli/commands/completion.ts
src/cli/registration-helpers.ts
src/mcp/server.ts
src/sdk/cli-contracts.ts
tests/unit/history-activity-command.spec.ts
tests/unit/contracts-command.spec.ts
tests/integration/mcp-dynamic-package-actions.spec.ts
tests/integration/cli.integration.spec.ts
tests/integration/release-readiness-runtime.spec.ts
tests/unit/restore-command.spec.ts
tests/unit/get-append-command.spec.ts
tests/unit/update-command.spec.ts
tests/unit/claim-command.spec.ts
tests/unit/beads-command.spec.ts
tests/unit/close-command.spec.ts
tests/unit/create-command.spec.ts
tests/unit/delete-command.spec.ts
tests/unit/test-command.spec.ts
tests/unit/todos-extension.spec.ts
docs/COMMANDS.md
docs/ARCHITECTURE.md
src/cli/help-content.ts
Extend gc to treat semantic vector cache artifacts (vectorization-status.json and lancedb directory) as embeddings scope targets and update guidance and tests accordingly.
  • Add new GC_TARGET entries for search/vectorization-status.json (file) and search/lancedb (directory) under the embeddings scope.
  • Update GC guidance logic to consider removal of vectorization-status.json and lancedb alongside manifest and embeddings.jsonl when deciding to emit reindex/search guidance.
  • Adjust unit and integration gc-command tests to seed vectorization-status.json and lancedb, expect them to be removed/retained appropriately across runs and scopes, and assert corresponding extension hook events and index:gc counts.
  • Update CLI integration gc test expectations for removed/retained arrays to reflect the new artifacts.
src/cli/commands/gc.ts
tests/unit/gc-command.spec.ts
tests/integration/cli.integration.spec.ts
Update internal PM agent artifacts to capture manual audit findings and verification details for items pm-rnpb and pm-3pbs.
  • Modify .agents/pm feature, history, and issue records for pm-rnpb and pm-3pbs to record manual dogfood, audit, and release verification evidence in the tracker.
  • Ensure these artifacts align with the new compact/full behavior and runtime audits without introducing duplicate items.
.agents/pm/features/pm-rnpb.toon
.agents/pm/history/pm-3pbs.jsonl
.agents/pm/history/pm-rnpb.jsonl
.agents/pm/issues/pm-3pbs.toon

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@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 reduces the default verbosity of the pm activity and pm history CLI commands by introducing a compact output mode, while providing a --full flag for users requiring complete JSON Patch payloads. It also enhances extension command handling by adding support for short flag parsing, canonicalization to long keys, and strict validation against declared flag definitions (checking for unknown, disabled, or missing required flags). Additionally, the pm gc command is expanded to clean up vectorization status and LanceDB artifacts. Feedback from the review identifies a precedence issue in subcommand flag lookup and suggests improving the accuracy of error messages when reporting unknown short flags.

Comment thread src/cli/main.ts Outdated
Comment on lines +576 to +591
const exact = collectExtensionFlagDefinitionsForCommand(registrations, commandPath);
if (exact.length > 0) {
return exact;
}
const pathParts = [commandPath];
for (const arg of commandArgs) {
if (arg.startsWith("-")) {
break;
}
pathParts.push(arg);
const nested = collectExtensionFlagDefinitionsForCommand(registrations, pathParts.join(" "));
if (nested.length > 0) {
return nested;
}
}
return [];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The current precedence logic for extension flag lookup returns the first match found, starting with the base commandPath. This means that if a parent command (e.g., acme) has flags defined, it will block the lookup for more specific subcommand flags (e.g., acme sync) when using dynamic command dispatch. The logic should be updated to search from the most specific path to the least specific.

Suggested change
const exact = collectExtensionFlagDefinitionsForCommand(registrations, commandPath);
if (exact.length > 0) {
return exact;
}
const pathParts = [commandPath];
for (const arg of commandArgs) {
if (arg.startsWith("-")) {
break;
}
pathParts.push(arg);
const nested = collectExtensionFlagDefinitionsForCommand(registrations, pathParts.join(" "));
if (nested.length > 0) {
return nested;
}
}
return [];
const pathParts = commandPath.split(" ").filter(Boolean);
for (const arg of commandArgs) {
if (arg.startsWith("-")) {
break;
}
pathParts.push(arg);
}
for (let i = pathParts.length; i >= 1; i--) {
const currentPath = pathParts.slice(0, i).join(" ");
const flags = collectExtensionFlagDefinitionsForCommand(registrations, currentPath);
if (flags.length > 0) {
return flags;
}
}

for (const key of Object.keys(options)) {
if (!allowed.has(key)) {
const expected = labels.length > 0 ? ` Expected one of: ${[...new Set(labels)].join(", ")}.` : "";
throw new PmCliError(`Unknown option '--${key}' for extension command '${commandPath}'.${expected}`, EXIT_CODE.USAGE);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The error message for unknown options hardcodes the -- prefix, which is misleading if the user provided a short flag (e.g., -d would be reported as --d). We should use a heuristic to determine the appropriate prefix based on the key length.

      const label = key.length === 1 ? `-${key}` : `--${key}`;
      throw new PmCliError(`Unknown option '${label}' for extension command '${commandPath}'.${expected}`, EXIT_CODE.USAGE);

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In normalizeActivityOptions, the returned compact flag is derived solely from options.full and always defaults to true, which means any explicit options.compact value (e.g., false when called programmatically) is ignored; consider honoring an explicit compact setting when present and only defaulting to true when neither compact nor full is provided.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `normalizeActivityOptions`, the returned `compact` flag is derived solely from `options.full` and always defaults to `true`, which means any explicit `options.compact` value (e.g., `false` when called programmatically) is ignored; consider honoring an explicit `compact` setting when present and only defaulting to `true` when neither `compact` nor `full` is provided.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli/extension-command-options.ts`:
- Around line 258-266: The loop over collectLooseOptionKeys(definition)
currently deletes alias entries even when the canonical key already exists,
which can drop user-provided alias values; update the logic in that loop (the
block referencing collectLooseOptionKeys(definition), canonical, and coerced) so
you only assign coerced[canonical] = coerced[key] and delete coerced[key] when
the canonical key does not already exist, and if coerced already has the
canonical key simply skip both the assignment and the deletion so alias values
are preserved (i.e., do not delete coerced[key] when Object.hasOwn(coerced,
canonical) is true).

In `@src/cli/main.ts`:
- Around line 576-592: The code returns exact flag definitions immediately
(exact variable) which prevents finding more specific nested flags from
commandArgs; modify the logic in the function that calls
collectExtensionFlagDefinitionsForCommand so that when exact.length > 0 you
still iterate commandArgs to look for nested matches (respecting the existing
arg.startsWith("-") break) and return nested if found, otherwise fall back to
exact; reference the exact and nested variables, commandPath and commandArgs,
and the collectExtensionFlagDefinitionsForCommand call to locate and implement
this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c8889a17-a323-4ca7-b06d-f011114bd408

📥 Commits

Reviewing files that changed from the base of the PR and between 9a73d8e and 50d8064.

📒 Files selected for processing (33)
  • .agents/pm/features/pm-rnpb.toon
  • .agents/pm/history/pm-3pbs.jsonl
  • .agents/pm/history/pm-rnpb.jsonl
  • .agents/pm/issues/pm-3pbs.toon
  • docs/ARCHITECTURE.md
  • docs/COMMANDS.md
  • src/cli/commands/completion.ts
  • src/cli/commands/gc.ts
  • src/cli/commands/history.ts
  • src/cli/extension-command-options.ts
  • src/cli/help-content.ts
  • src/cli/main.ts
  • src/cli/register-list-query.ts
  • src/cli/registration-helpers.ts
  • src/mcp/server.ts
  • src/sdk/cli-contracts.ts
  • tests/integration/cli.integration.spec.ts
  • tests/integration/mcp-dynamic-package-actions.spec.ts
  • tests/integration/release-readiness-runtime.spec.ts
  • tests/unit/beads-command.spec.ts
  • tests/unit/claim-command.spec.ts
  • tests/unit/close-command.spec.ts
  • tests/unit/contracts-command.spec.ts
  • tests/unit/create-command.spec.ts
  • tests/unit/delete-command.spec.ts
  • tests/unit/gc-command.spec.ts
  • tests/unit/get-append-command.spec.ts
  • tests/unit/history-activity-command.spec.ts
  • tests/unit/main-loose-options.spec.ts
  • tests/unit/restore-command.spec.ts
  • tests/unit/test-command.spec.ts
  • tests/unit/todos-extension.spec.ts
  • tests/unit/update-command.spec.ts

Comment thread src/cli/extension-command-options.ts
Comment thread src/cli/main.ts
@unbraind unbraind force-pushed the audit/token-output-activity-history-2026-05-20 branch from 50d8064 to 134eac5 Compare May 20, 2026 22:20
- default history/activity CLI output to compact projections with --full for audit payloads
- align completions, contracts, MCP activity handling, and docs with compact/full projections
- clean semantic search gc artifacts and reject unsupported dynamic extension flags
- record full manual audit findings and close pm-3pbs with 100% coverage evidence

Verification:
- pnpm build
- PM_RUN_TESTS_SKIP_BUILD=1 node scripts/run-tests.mjs test -- tests/unit/main-loose-options.spec.ts tests/integration/cli.integration.spec.ts tests/unit/contracts-command.spec.ts tests/unit/history-activity-command.spec.ts tests/unit/gc-command.spec.ts tests/integration/mcp-dynamic-package-actions.spec.ts --reporter=dot
- node scripts/run-tests.mjs coverage
- pnpm quality:static
- node scripts/check-secrets.mjs
@unbraind unbraind force-pushed the audit/token-output-activity-history-2026-05-20 branch from 134eac5 to 9288cc8 Compare May 20, 2026 22:23
@unbraind unbraind merged commit d2243b1 into main May 20, 2026
11 checks passed
@unbraind unbraind deleted the audit/token-output-activity-history-2026-05-20 branch May 20, 2026 22:39
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