Repository navigation
feat(skills): SkillIndex seam with a uteke doc adapter, pinned core and top-K recall - #613
Merged
Merged
Conversation
…nd top-K recall New tole-core module skill_index: the SkillIndex trait (search, upsert, retire) with a LocalIndex fallback and a uteke doc adapter (tag skill, slug skill-<name>, metadata with status, profile scope and a sha256 content hash; semantic search so the floor is a cosine). select() picks a pinned core of at most 5 plus the top K (default 5, max 10) above the floor; RecallQuery takes only the owner brief and profile role; the ReadOnly skill_search tool searches on demand. The index only finds names: descriptions and bodies come from the local skill files. Part 1 of #590; the session wiring follows.
# Conflicts: # CHANGELOG.md
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Part 1 of #590: a new
tole-coremodule,skill_index. It adds theSkillIndexseam, two adapters (LocalIndexand auteke docadapter), the selection of a pinned core plus the top K skills recalled by meaning, and a ReadOnlyskill_searchtool. Nothing uses the seam yet: the session wiring andtole skillscome in part 2.Why
Refs #590 (epic #589). Today
skills::index_blocklists every discovered skill in every prompt, so token cost grows and selection quality drops as the library grows. The owner decided on a pinned core of 3 to 5 skills, plus K = 5 (at most 10) skills recalled by meaning above a similarity floor, plus on-demand search, all through a seam whose first adapter isuteke doc. The design is indocs/skills-registry-design.md§4.1, §4.2, §4.3, §6.2 and §7.The whole #590 change came to about 1,650 lines, so it is split in two:
TOLE_SKILL_INDEX=uteke,runrecalls for its prompt, thetole skills index|retire|searchcommand, docs, and an end-to-end test with the real binary.Changes
skill_index.rs(new):SkillIndextrait:search(query, filter, k),upsert(entry),retire(name)andlabel().SkillFilterholds the profile scope and the similarity floor.SkillEntryholds the name, description, profiles, status and asha256:content hash; it never holds the body.LocalIndex: uses the skills directories as the index. It matches the query's words against each skill's name and description. This is the fallback when uteke is not available, and its scores are not cosines, so the floor does not apply.UtekeDocIndex(shell-toolsbuilds only): each skill is a uteke document with slugskill-<name>and tagskill, and its metadata is set withdoc update --metadata.searchcallsdoc search --mode semantic, because in semantic mode the score is a cosine and the floor means something; hybrid mode returns rank-fusion scores.skill-<name>, its score is at or above the floor, and its stored document (read withdoc get) has theskilltag, statusapproved, a matching name, and a profile scope that includes the session's profile (or no scope).upsertsends only# <name>and the description; the body stays local.retiresets the status toretiredand keeps the rest of the stored metadata.[a-z0-9-], not starting with a dash) is refused before any call.select: returns a task's skills. It takes the pinned core first (at most 5, in order; a missing pin becomes a note), then up to K recalled skills (K is capped at 10; it asks for K plus the number of pins, so pinned and missing names do not use up the K). Fewer or zero skills is fine. If the index fails,selectreturns the pinned skills and a note instead of an error.RecallQuery: built only from the owner-written brief and the profile role, so tool output cannot steer which skills are recalled. A dash-led brief is prefixed so it can never become a uteke flag, and the query is capped at 1,000 chars.selection_block: the system-prompt section. It always mentionsskill_search.SkillSearchTool: the ReadOnlyskill_searchtool. It returns names, scores and descriptions taken from the local files.skills.rs: newskill_file(workspace, name), the SKILL.md path thatload_skillwould read. Part 2 uses it to hash the raw bytes.tole-core/Cargo.toml: addssha2 = "0.11"for the content hash. It was already in the lock via rmcp, so no new crate is downloaded.docs/skills-registry-design.md.Testing
All run locally on head f2f47e0 (e96969d plus a merge of develop 06a599a, which brings in profiles #584; the only conflict was CHANGELOG.md, and both entries are kept):
cargo test --workspacepasses: 1411 passed, 0 failed (78 suites).cargo test -p tole-core --no-default-featurespasses: 481 passed, 0 failed. The module builds withoutshell-tools; only the uteke adapter is gated.cargo fmt --all -- --checkpasses.cargo clippy --workspace --all-targets -- -D warningspasses.cora review --no-llm --base origin/develop(cora v0.20.0): "No issues found". The LLM review is CI Cora Review.utekescript that answersdoc search/doc getin the JSON shape of uteke'sDocumentSearchResultandDocument(read from codecoradev/utekecrates/uteke-core/src/memory/documents.rs) and logs its argv. Part 2 adds an end-to-end test with the realtolebinary.New tests (10):
skill_index::tests:select_is_pinned_core_plus_top_k_from_local_filesselect_bounds_pins_and_k_and_degrades_on_index_errorsrecall_query_is_brief_and_role_only_and_never_flag_shapedlocal_index_matches_words_of_name_and_descriptionskill_search_tool_returns_local_descriptions_onlycontent_hash_is_sha256_hexskill_index::uteke_doc::tests:search_filters_by_tag_status_scope_and_floormalformed_search_output_is_an_error_not_an_empty_resultupsert_indexes_name_and_description_only_and_retire_keeps_metadataskills::tests::skill_file_follows_the_load_orderRed/green: each behavior was broken on purpose, the named test was seen failing, the file was restored, and the test passed again. All 12 core mutants were killed:
select_is_pinned_core…select_bounds_pins…select_bounds_pins…select_is_pinned_core…recall_query_is…,select_is_pinned_core…search_filters_by…search_filters_by…search_filters_by…skilltag ignoredsearch_filters_by…search_filters_by…upsert_indexes…skill_searchtrusts index text instead of the local fileskill_search_tool…Related Issues
Refs #590 (part 1 of 2; part 2 closes it). Epic #589. Next: #591 (approved-hash loading), which is not started here.
Checklist
feat/skill-index-seam)develop