Skip to content

feat: package rules — choose which articles ship as rules (0.7.104) - #116

Merged
qiansc merged 2 commits into
mainfrom
feat/package-rules
Nov 26, 2026
Merged

qiansc merged 2 commits into
mainfrom
feat/package-rules

Conversation

@qiansc

@qiansc qiansc commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Knowledge packages put every standards and test article under rules/. AI tools may load package rules into every session, so a package whose standards held long reference tables put about 260 KB into every Claude Code session. Which articles are binding rules is the author's decision, so this change lets the package declaration say it, and the build only warns.

Changes

  • kbPackage({ rules }). exclude ships matching standards/test articles under guides/ instead of rules/. alwaysApply writes alwaysApply: true into the frontmatter of rules every session needs, replacing a value the article declared. limits (fileKb 16, totalKb 64 by default) sets the size check. Patterns are knowledge paths with */** globs.
  • Build warning, no blocking. context package build adds a rules report to the package summary when a rule file or the rules/ total exceeds the limits: the files, their sizes and an instruction for src/index.ts. The output is unchanged. When the workspace SDK is older than the CLI (and would ignore rules), the report carries version_alignment and asks to upgrade the SDK first.
  • Guidance. The production guide reserves standards and test for short binding rules. The context Skill tells the Agent to propose rules settings from the report, change src/index.ts only after the user agrees, and rebuild. Package outputs guide and project API reference document the option.
  • The glob matching used by select.include moved to knowledgePathPatterns.ts and is shared.
  • Version 0.7.104.

Compatibility

  • New optional SDK field kbPackage.rules and optional rules field in the package build summary. No workspace file or CLI JSON field is removed or changed.
  • Packages without rules keep their build fingerprint, so upgrading the CLI does not rebuild them, and their output is unchanged.
  • Workspace SDKs before 0.7.104 ignore rules; the report says so through version_alignment.

Verification

  • New packageRules.integration.test.ts: oversized rule only warns; exclude moves the article to guides/ and removes the old rules/ file; alwaysApply is written once (replacing an existing value); an older SDK pin adds version_alignment. New okfTypes and SDK validation cases.
  • bun run build, bun run verify (typecheck, lint, all package tests), release:prepare (0.7.104). One unrelated test (projectPendingSourceUpdate) failed once under load in Git fixture setup and passes alone.

Checklist

  • bun run verify passes (full CI below).
  • Lifecycle changes include route and recovery tests. (No lifecycle change.)
  • Published package metadata and local pack behavior were checked when affected.
  • English and Simplified Chinese user documentation remain behaviorally equivalent. (These guides are English only.)
  • Runtime code remains compatible with Node.js 20+.
  • No generated output, secrets, private sources, or local workspaces are included.

🤖 Generated with Claude Code

qiansc and others added 2 commits November 26, 2026 11:21
kbPackage accepts rules: exclude ships matching standards/test articles under
guides/, alwaysApply marks rules every session needs, and limits sets the size
check. The build only warns when rules exceed the limits, and asks to upgrade
an older workspace SDK first. The context Skill and guides tell the Agent to
propose changes to the user before editing src/index.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qiansc
qiansc merged commit 08068db into main Nov 26, 2026
2 checks passed
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