Skip to content

fix(hooks): drop wing_ prefix from transcript-derived wings#9

Merged
jphein merged 1 commit intomainfrom
fix/drop-wing-prefix
May 6, 2026
Merged

fix(hooks): drop wing_ prefix from transcript-derived wings#9
jphein merged 1 commit intomainfrom
fix/drop-wing-prefix

Conversation

@jphein
Copy link
Copy Markdown
Owner

@jphein jphein commented May 6, 2026

Summary

_wing_from_transcript_path returned wing_<project> for hook-derived wings, while operator-mined content from mempalace mine ~/Projects/X lands in a bare-name wing. Result: every project that has both kinds of content silently splits between wing_X and X — invisible to a filtered search by either name.

This PR drops the prefix. The fallback wing_sessionssessions (which already exists with 2,132 drawers in JP's canonical palace, so future fallback content converges with older fallback content).

A separate one-shot script handles renaming the existing 28K+ wing_* drawers on the live palace so legacy hook content merges into the corresponding bare-name wings.

Why

Live palace state pre-fix:

existing drawers source
memorypalace 207 manual mine
wing_realmwatch 12,195 hook-derived
wing_techempower 8,556 hook-derived

Same project, two wings. Search either way and you miss the other.

Test plan

  • 9 test assertions updated to expect bare-name shape
  • 1548 passed, 1 skipped, ruff clean

🤖 Generated with Claude Code

The fork-only _wing_from_transcript_path returned wing_<project> for
hook-derived wings, but operator-mined content from `mempalace mine
~/Projects/X` lands in a bare-name wing (e.g. memorypalace, mempalace,
projects). Result: every project with both manual-mined content AND
hook-mined transcripts had its drawers split between "wing_X" and
"X" — silently invisible to a search filtered by either name.

Drop the prefix. _wing_from_transcript_path now returns the bare
project name (lowercased, spaces → underscores), matching the
operator-mine convention. Fallback "wing_sessions" → "sessions"
(which already exists in JP's canonical palace with 2,132 drawers
from earlier hook-derived ingest with hardcoded --wing sessions, so
new fallback content converges with the older fallback content too).

A separate one-shot script renames legacy wing_<x> drawers'
metadata so they merge into <x> on the live palace.

Tests: 9 wing-related assertions updated to expect bare-name shape;
1548 pass, 1 skipped, lint clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 6, 2026 01:53
@jphein jphein merged commit 86d4700 into main May 6, 2026
7 checks passed
@jphein jphein deleted the fix/drop-wing-prefix branch May 6, 2026 01:53
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 aligns hook-derived transcript ingestion with operator-mined project wings by changing _wing_from_transcript_path() to return bare project wing names (and sessions as the fallback) instead of the wing_<project> / wing_sessions prefixed shape, preventing content from silently splitting across two wings for the same project.

Changes:

  • Update _wing_from_transcript_path() to drop the wing_ prefix and rename the default fallback to sessions.
  • Update hook CLI tests to assert the new bare-name wing behavior in system messages and daemon routing.

Reviewed changes

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

File Description
mempalace/hooks_cli.py Changes transcript-path → wing derivation to return bare project names and sessions fallback.
tests/test_hooks_cli.py Updates assertions to match the new wing naming behavior for transcript ingestion.

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

Comment thread mempalace/hooks_cli.py
Comment on lines +525 to +527
Returns the project directory's basename, lowercased, with spaces
collapsed to underscores. Falls back to ``"sessions"`` for paths
that don't match the standard Claude Code projects layout.
Comment thread mempalace/hooks_cli.py
Comment on lines 539 to +543
if match:
encoded = match.group(1)
project = encoded.rsplit("-", 1)[-1]
if project:
return f"wing_{project.lower().replace(' ', '_')}"
return project.lower().replace(" ", "_")
jphein added a commit that referenced this pull request May 6, 2026
…ing_name (#10)

Two findings from Copilot review on #9 (already merged):

1. **Last-dash-token rule lost hyphenated project names.** A project
   directory named ``realm-watch`` is encoded by Claude Code as
   ``-home-jp-Projects-realm-watch``, and the previous primary
   regex's ``rsplit('-', 1)[-1]`` returned ``watch`` — collapsing
   the project name. Reorder the resolution: try the explicit
   ``-Projects-<name>`` segment FIRST (preserves dashes), fall back
   to the last-dash-token only when the path is in a non-Projects
   layout (``~/dev/<parent>/<project>``).

2. **Inconsistent normalization vs operator mines.** Hook used
   ``.lower().replace(' ', '_')`` (no hyphen handling) while
   ``mempalace mine`` runs the dirname through
   ``normalize_wing_name`` (lowercases, dashes/spaces → underscores).
   Same project mined two ways produced two different wings.
   Route the hook through ``normalize_wing_name`` for parity.

Net behavior: ``-Projects-realm-watch`` → ``realm_watch`` (matches
operator-mine output). Existing tests for non-dashed projects still
pass; 4 new tests cover dashed-project + uppercase-mixed cases +
explicit operator-mine convergence assertion.

Tests: 1551 pass, 1 skipped. Ruff lint + format clean.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.

2 participants