Skip to content

perf(agent-package): index archive entries by skill path - #568

Open
Yevanchen wants to merge 1 commit into
mainfrom
perf/agent-package-archive-index
Open

perf(agent-package): index archive entries by skill path#568
Yevanchen wants to merge 1 commit into
mainfrom
perf/agent-package-archive-index

Conversation

@Yevanchen

Copy link
Copy Markdown
Collaborator

Summary

  • Index non-empty package archive entries by declared skill path in one pass.
  • Preserve manifest order, archive-entry order, missing-skill behavior, and overlapping skill-root projection.

Why

  • Package import previously filtered every archive entry once per declared skill, for O(skills × entries) matching work.
  • The new prefix index reduces matching to O(skills + entries × path depth + matched assets).
  • A synthetic 300-skill, 6,000-entry archive improved from 41.83 ms to 0.86 ms per import (about 49×) on the same runner.

Closes YEF-1078

Verification

  • Commands:
    • just test-file pkgs/agent-package/tests/archive-entry-admission.test.ts
    • just test-package @mosoo/agent-package
    • just tc-package @mosoo/agent-package
    • bun run --filter @mosoo/agent-package lint
    • just fmt-check-path pkgs/agent-package/src/archive-assets.ts
    • just fmt-check-path pkgs/agent-package/tests/archive-entry-admission.test.ts
    • just commit-check
    • just check (format, docs, lint, and typecheck passed; test phase stopped on 11 unmodified Driver process-watchdog/PID timing failures on macOS)
  • Manual steps: N/A
  • Not run: N/A

Impact

  • User/API/contract changes: None; package import output and issue behavior are preserved.
  • Generated files / GraphQL / DB / lockfile: None.
  • Env or config changes: None.
  • Risk and rollback: Low; rollback by reverting the single commit.

Review

  • Closest review areas: archive path-prefix matching and overlapping declared skill roots.
  • Known trade-offs: The index adds memory proportional to declared skill paths and matched assets, while avoiding repeated full archive scans.

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