fix: harden scoped memory tools and projection lifecycle#276
Closed
esafwan wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Superseded by the unified implementation in PR #282. All the code and concepts from this PR have been integrated into that branch, alongside fully functioning background learning agents and hybrid search backends. |
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.
Motivation
Knowledge Inputpipeline without claiming immediate indexing.Description
huf/ai/memory_tools.pywith whitelisted APIssave_memory_record,get_memory_record,search_memory_records,archive_memory_record, andpromote_memory_to_knowledge, plus handler aliaseshandle_*for each public function, and safe helpers (_is_manager,_resolve_scope_key,_can_read_memory,_can_write_memory,_json_value).Role/Workspace/Site/Globalwrites, non-managers cannot promote to knowledge, conversation/user/agent checks), capped search results to50, and implemented query matching acrosstitle,summary_text,record_type, andtags.huf/huf/doctype/agent_tool_function/agent_tool_function.json(Save Memory Record,Search Memory Records,Get Memory Record,Archive Memory Record,Promote Memory to Knowledge) and wired those types to the handlers insidehuf/ai/sdk_tools.pyso tools created from Agent Tool Function documents can call memory handlers directly.save_memory_recordresolvesscope_keysafely (conversation/user/agent/site/global), prevents helper/parameter shadowing, and callsqueue_knowledge_projection()only when appropriate and manager-permitted; all DB writes use explicit permission-aware saves (ignore_permissions=Falsewhere applicable).Testing
python -m py_compile huf/ai/memory_tools.py,python -m py_compile huf/huf/doctype/memory_record/memory_record.py, andpython -m py_compile huf/huf/doctype/memory_policy/memory_policy.py(all passed).bench --site all migrate,bench --site all clear-cache, andbench build --app huf(failed due tobench: command not found).bench --site <site> migrate,bench --site <site> run-tests --app huf --doctype "Memory Record"andbench build --app hufbefore merging.Codex Task