Repository navigation
feat(bip39): split glued words - #443
Conversation
Architecture Inside the changed components — 1 viewComponent view — BIP39 Word Segmentation Internal dispatch and algorithm modules for glued word segmentation
Data flow Review ✨ Nothing flagged · reviewed Tip The CLI's 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 17 files
Linked issue analysis
Linked issue: agntn/keys#440: Split glued BIP39 words and check each split
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Split glued letters into complete BIP39 phrases | splitWords builds complete covers for 12, 15, 18, 21, and 24 words; tests reject partial coverage. |
| ✅ | Use an explicit language-specific BIP39 word list | The tool loads the requested language, and splitWords accepts a supplied wordlist; tests cover Czech and other lists. |
| ✅ | Check the checksum for every split | splitWords yields a checksum verdict for each cover, and the ambiguous example verifies that only one split passes. |
| ✅ | Count splits and passing splits, then page results safely | The tool reports total and valid counts, supports limit and offset, and refuses searches above its cap. |
| ✅ | Reject inputs that cannot be fully covered | An uncovered letter produces no split, and the tests confirm the result is not a partial phrase. |
Architecture diagram
sequenceDiagram
participant CLI as CLI / MCP Client
participant Tool as keys_bip39_words_segment Tool
participant Exec as segmentBip39Words()
participant Split as splitWords / countWordSplits
participant Graph as Split Graph Builder
participant Wordlist as BIP39 Wordlist
participant Checksum as checksumTest()
Note over CLI,Checksum: Glued Word Segmentation Flow
CLI->>Tool: callTool("keys_bip39_words_segment", { letters, all, limit, offset, language })
Tool->>Tool: Validate via SEGMENT_BIP39_WORDS_PARAMETERS schema
alt Valid arguments
Tool->>Exec: execute({ letters, options }, { signal })
Exec->>Exec: segmentLetters() - validate non-empty, max 1024 chars
Exec->>Exec: parseBIP39Language() - default english
Exec->>Split: countWordSplits(letters, { wordlist })
Split->>Graph: buildGraph(letters, options)
Graph->>Graph: foldLetters() - normalize, strip whitespace, validate letters only
Graph->>Graph: findWords() - map word prefixes to indices
Graph->>Graph: countCovers() - dynamic programming for split counts
Graph-->>Split: count of possible splits per word count (12/15/18/21/24)
Split-->>Exec: total split count (bigint)
alt More than MAX_BIP39_CHECKSUM_SEARCH splits
Exec->>Exec: Throw RangeError - cap exceeded
else Within limit
Exec->>Split: splitWords(letters, { wordlist })
loop Each word count (12, 15, 18, 21, 24)
Split->>Checksum: checksumTest(count) - get validation function
loop Each valid split
Split->>Checksum: Validate checksum
Checksum-->>Split: Valid / Invalid
Split-->>Exec: { words, checksumValid }
end
end
Exec->>Exec: segmentPage() - filter by "all" flag, apply offset/limit
Exec->>Exec: segmentText() - format output with counts and splits
Exec-->>Tool: ToolResult with content + details
Tool-->>CLI: Formatted response (counts + listed splits)
end
else Invalid arguments
Tool-->>CLI: Error response with validation message
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Adds a new, well-tested BIP39 glued-word splitting library API and agent tool behind explicit caps, with docs and tests; existing behavior is unchanged and the change is additive and bounded.
Re-trigger cubic
🔸 What this resolves
Closes #440
🔶 Why it's needed
keys_bip39_words_segmentlists the BIP39 phrases a run of glued letters can be cut into, and the checksum pickscarpetovercar pet.