Skip to content

feat(adf): migrate should classify rules into on-demand modules, not just core.adf #6

Closed

Description

@SmartBrandStrategies

Summary

charter adf migrate extracts rules from agent config files (agents.md, .cursorrules) and merges everything into core.adf, even when content clearly belongs in on-demand modules like frontend.adf or backend.adf.

Example

Given an agents.md with mixed content:

React components: PascalCase.tsx
Hooks/utilities: camelCase.ts
Hono route composition for worker/backend APIs
npm run db:local creates the local D1 schema

The migration classifies all of these as CONSTRAINTS → core.adf:

"React components: PascalCase.tsx"        → CONSTRAINTS [advisory]  core.adf
"Hono route composition for worker/..."   → CONSTRAINTS [advisory]  core.adf
"npm run db:local creates the local..."   → CONSTRAINTS [advisory]  core.adf

Expected Behavior

The migration should route rules to the appropriate on-demand module when the manifest declares them:

Rule Target
React component naming conventions frontend.adf
Vite dev server commands frontend.adf
Hono route patterns backend.adf
D1 schema/migration commands backend.adf
TypeScript strictness, commit conventions core.adf

Suggested Approach

Use the ON_DEMAND module metadata from manifest.adf (which already includes keyword hints like react, css, ui for frontend and api, node, db for backend) to classify migrated rules into the best-fit module rather than defaulting everything to core.

This would make the on-demand modules useful out of the box instead of leaving them as empty scaffolds after migration.

Activity

  1. SmartBrandStrategies commented on Mar 2, 2026

    @SmartBrandStrategies
    ContributorAuthor

    Update: The routing logic already exists in `content-classifier.ts` on both main and v0.5.0 — keyword-based matching routes to `frontend.adf` / `backend.adf` / `core.adf`:

    ```ts
    if (/\b(design.system|ui|frontend|css|component|react|vue|svelte)\b/.test(lower)) {
    return 'frontend.adf';
    }
    if (/\b(api|backend|deploy|server|database|db|endpoint)\b/.test(lower)) {
    return 'backend.adf';
    }
    return 'core.adf';
    ```

    However, when tested with v0.4.2, all 23 rules routed to `core.adf` despite rules containing keywords like "React", "Hono", "D1", "db:local". The `applyMigrationToModule()` function does handle missing files (creates an empty ADF doc), so that's not the blocker.

    Possible causes:

    1. The classifier regex isn't matching because the rule text is e.g. `"React components: PascalCase.tsx"` where "React" is at the start — the `\b` word boundary should match this. Need to verify the `lower` variable is actually the item text and not a section heading.
    2. The published 0.4.2 npm package may not include the latest `content-classifier.ts` from main (build artifact drift).

    This needs investigation — the code looks correct but the runtime behavior doesn't match.

  2. added this to the v0.6.0 milestone on Mar 2, 2026
  3. added a commit that references this issue on Mar 3, 2026
    98b830b
  4. added a commit that references this issue on Mar 3, 2026
    28e838c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions