Skip to content

fix: normalize skill names and avoid subagent tool conflicts in pi#288

Open
dragosdm wants to merge 1 commit intoEveryInc:mainfrom
dragosdm:fix/pi-skill-name-normalization
Open

fix: normalize skill names and avoid subagent tool conflicts in pi#288
dragosdm wants to merge 1 commit intoEveryInc:mainfrom
dragosdm:fix/pi-skill-name-normalization

Conversation

@dragosdm
Copy link
Copy Markdown

Summary

Fix Pi compatibility for Compound Engineering by:

  1. normalizing Pi skill names during install and sync
  2. avoiding tool conflicts with pi-subagents by using a dedicated CE tool name

What changed

Pi skill-name normalization

  • normalize Pi skill names to lowercase hyphenated form
  • rewrite copied SKILL.md frontmatter so name: matches the normalized target directory
  • keep Pi install parity with the Compound Engineering plugin source
  • keep Pi sync parity with Claude home input while avoiding invalid Pi skill names

Examples:

  • ce:plan -> ce-plan
  • generate_command -> generate-command
  • resolve_parallel -> resolve-parallel

Pi subagent conflict avoidance

  • rename the CE Pi compat tool from subagent to ce_subagent
  • rewrite Pi-installed CE content so Task-style delegation uses ce_subagent
  • keep generic subagent available for pi-subagents
  • update Pi compatibility notes accordingly

This allows CE Pi installs to coexist with pi-subagents in the same runtime without tool-name conflicts.

Implementation notes

  • Pi-only sync behavior now lives in a dedicated Pi path instead of leaking into shared sync helpers
  • Pi prompt normalization was aligned with Pi skill/body rewrite behavior
  • Pi sync now cleanly replaces existing symlink targets when materialization is needed

Validation

Automated

Ran the full test suite locally

Result:

  • 329 pass
  • 0 fail

Manual smoke tests

Verified locally that:

  • install ./plugins/compound-engineering --to pi produces no invalid Pi skill names
  • CE workflow skills are installed with Pi-safe names
  • CE-installed Pi content references ce_subagent
  • ce_subagent works at runtime
  • subagent from pi-subagents still works at runtime
  • both tools can coexist in the same Pi session

Why this matters

Before this change, Pi installs/syncs could produce invalid skill names such as:

  • ce:plan
  • generate_command

and CE’s Pi compatibility extension conflicted with pi-subagents because both registered subagent.

After this change:

  • Pi output is valid
  • CE install/sync parity is preserved
  • CE and pi-subagents can coexist cleanly

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 993150a to 5570e1f Compare March 17, 2026 11:29
@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 17, 2026

@kieranklaassen this is interesting suggestion because it also addresses cross platform compat with directory and skill names issues with colons not working with windows for example if we ever want folders to match skill names directly.

Using a hyphen is likely a better way to go so we don't overload the usage of what : means. E..g Claude Code already uses a colon to scope skills within a given plugin but we are using it a bit hacky in skill names themselves.

Long term probably makes sense for us to to rename the skills but not worth blocking this now so Pi can get unblocked with the fix

@tmchow tmchow requested a review from Copilot March 18, 2026 03:41
@tmchow tmchow changed the title fix(pi): normalize skill names and avoid subagent tool conflicts fix: normalize skill names and avoid subagent tool conflicts in pi Mar 18, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the Pi target compatibility layer for Compound Engineering by ensuring Pi-safe skill/prompt naming and avoiding tool-name collisions with other Pi extensions (notably pi-subagents).

Changes:

  • Normalize Pi skill/prompt/agent names into lowercase hyphenated form, with collision-safe suffixing.
  • Materialize Pi skills (copy + rewrite) when name/body/frontmatter rewrites are required; otherwise keep symlink parity.
  • Rename the Pi compat tool from subagent to ce_subagent and rewrite Task-style delegation accordingly.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/sync-pi.test.ts Adds coverage for Pi materialization behavior (invalid names, body rewrites, symlink replacement).
tests/pi-writer.test.ts Verifies copied skill frontmatter name is rewritten to match Pi-safe directory and body rewrites use ce_subagent.
tests/pi-converter.test.ts Updates expectations for normalized names and ce_subagent; adds collision normalization test.
src/utils/pi-skills.ts New utilities for Pi name normalization, body rewrites, skill copying, and frontmatter rewriting.
src/templates/pi/compat-extension.ts Renames registered Pi tool to ce_subagent and updates metadata.
src/targets/pi.ts Writes Pi bundles using Pi-aware skill copying/rewriting and updates compatibility notes.
src/sync/pi.ts Switches Pi sync to use a Pi-specific skills sync path.
src/sync/pi-skills.ts New Pi-specific skills sync: normalize names, decide symlink vs materialize, handle collisions.
src/converters/claude-to-pi.ts Uses shared Pi normalization/rewrites, normalizes copied skill names, and avoids name collisions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@dragosdm
Copy link
Copy Markdown
Author

@tmchow, how would you like to proceed: accept copilot suggestions or should I fix them?

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 18, 2026

@tmchow, how would you like to proceed: accept copilot suggestions or should I fix them?

I don’t trust copilot’s solutions but trust it’s diagnosis 😆

do you mind looking looking at the flagged problems and implementing solutions?

@dragosdm
Copy link
Copy Markdown
Author

@tmchow I've pushed the commit with the fixes:

  • made copySkillDirForPi safer by backing up existing real directories instead of deleting them
  • kept symlink replacement behavior for managed/symlink targets
  • made the MCPorter compatibility note idempotent
  • added tests for both behaviors

Copy link
Copy Markdown
Collaborator

@tmchow tmchow left a comment

Choose a reason for hiding this comment

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

Good work overall — the core logic is correct, fixes real pre-existing bugs (skill names reserved but not normalized in output, agent bodies never transformed for Pi), and has solid test coverage.

A few things to clean up before merging:

1. Dead export: isValidPiSkillName is never imported

src/utils/pi-skills.ts exports isValidPiSkillName but nothing imports it — not the sync path (which uses isValidSkillName from utils/symlink.ts), not the converter, not tests. Either remove it or wire it up where it belongs.

2. Backup directory accumulation

copySkillDirForPi creates timestamped .bak directories on every materialization but never cleans up old ones. Repeated installs/syncs will accumulate stale backups in the user's Pi skills directory indefinitely. Either clean up previous .bak dirs before creating a new one, or cap the number retained.

3. Run subagent with catch-all is too broad

result = result.replace(/\bRun subagent with\b/g, `Run ${PI_CE_SUBAGENT_TOOL} with`)

This could false-positive on prose that coincidentally contains "Run subagent with". Tighten the pattern to match the actual generated format, e.g. Run subagent with agent= instead of just Run subagent with.

@dragosdm
Copy link
Copy Markdown
Author

  • Dead isValidPiSkillName export: removed
  • Backup accumulation: pruneOldPiSkillBackups now cleans up old .bak dirs before creating a new one. Added two tests: one verifying only the latest backup survives repeated syncs, one verifying pruning skips symlinks and plain files
  • Run subagent with too broad: tightened to Run subagent with agent=. Added positive and negative test cases

Also made two small improvements:

  • Replaced pathExists + lstat two-step with a single lstat try/catch
  • Switched backup pruning to readdir({ withFileTypes: true }) to skip extra lstat calls

Squashed everything into a single commit.
Tests: 335 pass, 0 fail.

@tmchow back to you :)

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 18, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ce0ea530b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 7ce0ea5 to af1c67d Compare March 20, 2026 23:23
@dragosdm
Copy link
Copy Markdown
Author

@tmchow, ready for another round of review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af1c67d75e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from af1c67d to c0b55e8 Compare March 20, 2026 23:38
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0b55e8e74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from c0b55e8 to bcb1538 Compare March 21, 2026 00:28
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcb15383e4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from bcb1538 to 2268bd4 Compare March 21, 2026 00:49
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2268bd4814

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 2268bd4 to 5c9c3ea Compare March 21, 2026 05:22
@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 21, 2026

@codex re-review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c9c3eabe5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 5c9c3ea to 8e0cd6e Compare March 21, 2026 06:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e0cd6ec16

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm
Copy link
Copy Markdown
Author

@tmchow I don't think the last codereview brought something to fix/implement (left a comment above).

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 22, 2026

Heads up — #334 overlaps with part of this work but is complementary, not competing.

What #334 does that's relevant here:

  • Fixes the Task call regex across all converters (including Pi) to support namespaced agent names and zero-argument calls like Task agent(). The current regex uses [^)]+ which requires at least one character — [^)]* fixes it.
  • Makes all 7 target writers (not just Codex) transform SKILL.md content in copied skill directories, so Task calls inside pass-through skills get rewritten. This was a gap — copyDir() was copying verbatim.

What this PR does that #334 doesn't:

  • Pi skill name normalization (ce:plance-plan)
  • ce_subagent rename to avoid tool conflicts with pi-subagents
  • Pi-specific sync behavior
  • Frontmatter rewriting

Overlap to resolve when merging both:

  • src/converters/claude-to-pi.ts — both PRs touch the Task regex and transformContentForPi. Check if your work has the zero-arg bug ([^)]+ vs [^)]*).
  • src/targets/pi.tsfeat: fix skill transformation pipeline across all targets #334 switches to a shared copySkillDir utility for SKILL.md transformation; your PR has its own Pi-specific approach.
  • tests/pi-converter.test.ts and tests/pi-writer.test.ts — both add tests, should merge cleanly.

The two PRs should merge fine with minor conflict resolution. Main thing to check: make sure the zero-arg Task regex fix ([^)]*) lands in the Pi converter regardless of merge order.

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 8e0cd6e to 8cf1c90 Compare March 22, 2026 13:43
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ff8c20ae3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 5ff8c20 to 93c236b Compare March 22, 2026 21:00
Copy link
Copy Markdown
Collaborator

@tmchow tmchow left a comment

Choose a reason for hiding this comment

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

Found 1 issue:

  1. appendCompatibilityNoteIfNeeded is now applied to agent skill files, not just prompts

Previously, appendCompatibilityNoteIfNeeded was called only inside convertPrompt — agents went through transformContentForPi without it. The PR moves appendCompatibilityNoteIfNeeded inside transformPiBodyContent (line 85), which is now called for both prompts and agents. Any agent whose body mentions "mcp" will get the MCPorter compatibility note appended to its generated SKILL.md. This note contains user-facing guidance (mcporter_list, mcporter_call) that makes sense in human-invoked prompts but is inappropriate in machine-read agent skill files.

return appendCompatibilityNoteIfNeeded(result)
}

Called for agents here:

const body = transformPiBodyContent([
...sections,

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 93c236b to f8fd18e Compare March 23, 2026 06:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8fd18ea9c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm
Copy link
Copy Markdown
Author

@tmchow let me know if there's anything else to address.

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 25, 2026

@dragosdm rebase against main to resolve issues again.

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from f8fd18e to 0bff8ea Compare March 25, 2026 09:52
@dragosdm
Copy link
Copy Markdown
Author

@tmchow rebased

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 25, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bff8ea6d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from 0bff8ea to a5f936c Compare March 25, 2026 14:21
@dragosdm
Copy link
Copy Markdown
Author

codex comment was valid and fixed with last commit

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5f936c821

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

: `${prefix}Run ${PI_CE_SUBAGENT_TOOL} with agent="${normalizedAgent}".`
})

result = result.replace(/\bRun subagent with agent="/g, `Run ${PI_CE_SUBAGENT_TOOL} with agent="`)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remap agent names when rewriting Run subagent calls

transformPiBodyContent() only renames the tool token in existing Run subagent with agent="..." lines, but it never normalizes/remaps the agent value through nameMaps. When agent/skill names are normalized or deduplicated for Pi (for example code_review -> code-review-2), these pre-existing subagent invocations are converted to ce_subagent while still pointing at the old name, which causes runtime "skill not found" failures for converted/synced content that already used explicit subagent syntax instead of Task ....

Useful? React with 👍 / 👎.

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from a5f936c to b822162 Compare March 25, 2026 14:48
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b822162c42

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from b822162 to adc3af7 Compare March 25, 2026 15:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adc3af7961

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +171 to +173
const updated = formatFrontmatter(
{ ...parsed.data, name: targetName },
transformPiBodyContent(parsed.body, nameMaps),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve nested frontmatter when rewriting Pi skills

rewriteSkillFileForPi now reserializes every parsed SKILL.md frontmatter via formatFrontmatter, but that formatter only supports scalars/arrays and stringifies plain objects (via String(value) in src/utils/frontmatter.ts) to "[object Object]". In any skill whose frontmatter includes nested maps (for example metadata: or structured config), install/sync to Pi will silently corrupt those fields, which can break downstream tooling that reads that metadata.

Useful? React with 👍 / 👎.

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from adc3af7 to e753560 Compare March 25, 2026 15:32
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7535609ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from e753560 to d1c5082 Compare March 25, 2026 15:50
@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 25, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1c5082add

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Normalize Pi skill names to lowercase-hyphen form (ce:plan → ce-plan)
- Truncate normalized names to 60 chars to stay within Pi's 64-char limit
- Rename CE compat tool from subagent to ce_subagent to avoid pi-subagents collision
- Rewrite Task calls, slash commands, and tool refs in copied/synced Pi content
- Support zero-argument Task calls (Task agent() with no args)
- Resolve Task, /skill:, and slash refs against deduped name maps in converter and sync
- Two-pass name allocation for skills, agents, and prompts to handle collisions
- Sort skills, agents, and commands before dedup for deterministic allocation across runs
- Use locale-independent codepoint sort for cross-platform stability
- Pass prompt maps from sync orchestrator into skill sync for cross-reference resolution
- Fall through /skill: refs to agent map since Pi uses a flat skills/ namespace
- Thread name maps through writer path so copied skills use deduped names
- Rewrite frontmatterless skill bodies during Pi copy
- Fallback-rewrite malformed-frontmatter skill bodies (body only, preserving broken YAML)
- Apply MCPorter compatibility note only to prompts, not agent skill files
- Handle dangling symlinks during skill dir cleanup using lstat instead of access
- Back up existing skill dirs before overwrite, retain most recent backup
- Skip symlinks during backup cleanup to prevent unintended deletions
- Strip doubled quotes from Task args and tighten subagent regex to avoid false positives
- Use sentinel comment for MCPorter note idempotency
- Write compat extension during skills-only sync
- Guard parseFrontmatter calls against malformed YAML with warnings
@dragosdm dragosdm force-pushed the fix/pi-skill-name-normalization branch from d1c5082 to f20ff61 Compare March 25, 2026 16:29
@dragosdm
Copy link
Copy Markdown
Author

@tmchow shall we do another round?

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 26, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f20ff61069

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (activeRealDirs.has(resolvedPath)) {
throw cyclicPiSkillSymlinkError(sourcePath)
}
await copyDirForPiMaterialization(resolvedPath, targetPath, activeRealDirs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent copying symlink targets outside skill root

The new Pi materialization path follows symlinks via realpath and then recursively copies the resolved location, but it never verifies that the target stays inside the source skill directory. A skill containing a symlink like assets -> / (or any external path) will copy arbitrary host files into the Pi output, which is a security and performance regression from the prior behavior that ignored symlinks. Add a containment check (or keep symlinks as links) before recursing/copying resolved targets.

Useful? React with 👍 / 👎.

@tmchow
Copy link
Copy Markdown
Collaborator

tmchow commented Mar 26, 2026

@dragosdm there’s so much thrashing going on this PR that here’s what I suggest you do aside from just resolving that one comment from the codex review above: do a thorough AI code review asking it to review all the classes of PR feedback that you got and all the bugs and make sure that it’s poking holes in all the surrounding areas because the same type of feel like he’s coming back up just in different ways

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.

3 participants