mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-06 10:47:12 +08:00
Compare commits
2 Commits
dependabot
...
hermes/her
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b95395c010 | ||
|
|
9d2e112455 |
@@ -73,9 +73,15 @@ DEFAULT_AGENT_IDENTITY = (
|
|||||||
MEMORY_GUIDANCE = (
|
MEMORY_GUIDANCE = (
|
||||||
"You have persistent memory across sessions. Save durable facts using the memory "
|
"You have persistent memory across sessions. Save durable facts using the memory "
|
||||||
"tool: user preferences, environment details, tool quirks, and stable conventions. "
|
"tool: user preferences, environment details, tool quirks, and stable conventions. "
|
||||||
"Memory is injected into every turn, so keep it compact. Do NOT save task progress, "
|
"Memory is injected into every turn, so keep it compact and focused on facts that "
|
||||||
"session outcomes, or completed-work logs to memory; use session_search to recall "
|
"will still matter later.\n"
|
||||||
"those from past transcripts."
|
"Prioritize what reduces future user steering — the most valuable memory is one "
|
||||||
|
"that prevents the user from having to correct or remind you again. "
|
||||||
|
"User preferences and recurring corrections matter more than procedural task details.\n"
|
||||||
|
"Do NOT save task progress, session outcomes, completed-work logs, or temporary TODO "
|
||||||
|
"state to memory; use session_search to recall those from past transcripts. "
|
||||||
|
"If you've discovered a new way to do something, solved a problem that could be "
|
||||||
|
"necessary later, save it as a skill with the skill tool."
|
||||||
)
|
)
|
||||||
|
|
||||||
SESSION_SEARCH_GUIDANCE = (
|
SESSION_SEARCH_GUIDANCE = (
|
||||||
@@ -86,8 +92,11 @@ SESSION_SEARCH_GUIDANCE = (
|
|||||||
|
|
||||||
SKILLS_GUIDANCE = (
|
SKILLS_GUIDANCE = (
|
||||||
"After completing a complex task (5+ tool calls), fixing a tricky error, "
|
"After completing a complex task (5+ tool calls), fixing a tricky error, "
|
||||||
"or discovering a non-trivial workflow, consider saving the approach as a "
|
"or discovering a non-trivial workflow, save the approach as a "
|
||||||
"skill with skill_manage so you can reuse it next time."
|
"skill with skill_manage so you can reuse it next time.\n"
|
||||||
|
"When using a skill and finding it outdated, incomplete, or wrong, "
|
||||||
|
"patch it immediately with skill_manage(action='patch') — don't wait to be asked. "
|
||||||
|
"Skills that aren't maintained become liabilities."
|
||||||
)
|
)
|
||||||
|
|
||||||
PLATFORM_HINTS = {
|
PLATFORM_HINTS = {
|
||||||
@@ -326,6 +335,9 @@ def build_skills_system_prompt(
|
|||||||
"Before replying, scan the skills below. If one clearly matches your task, "
|
"Before replying, scan the skills below. If one clearly matches your task, "
|
||||||
"load it with skill_view(name) and follow its instructions. "
|
"load it with skill_view(name) and follow its instructions. "
|
||||||
"If a skill has issues, fix it with skill_manage(action='patch').\n"
|
"If a skill has issues, fix it with skill_manage(action='patch').\n"
|
||||||
|
"After difficult/iterative tasks, offer to save as a skill. "
|
||||||
|
"If a skill you loaded was missing steps, had wrong commands, or needed "
|
||||||
|
"pitfalls you discovered, update it before finishing.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"<available_skills>\n"
|
"<available_skills>\n"
|
||||||
+ "\n".join(index_lines) + "\n"
|
+ "\n".join(index_lines) + "\n"
|
||||||
|
|||||||
15
run_agent.py
15
run_agent.py
@@ -812,7 +812,7 @@ class AIAgent:
|
|||||||
logger.debug("peer %s memory_mode=honcho: local USER.md writes disabled", _hcfg.peer_name or "user")
|
logger.debug("peer %s memory_mode=honcho: local USER.md writes disabled", _hcfg.peer_name or "user")
|
||||||
|
|
||||||
# Skills config: nudge interval for skill creation reminders
|
# Skills config: nudge interval for skill creation reminders
|
||||||
self._skill_nudge_interval = 15
|
self._skill_nudge_interval = 10
|
||||||
try:
|
try:
|
||||||
from hermes_cli.config import load_config as _load_skills_config
|
from hermes_cli.config import load_config as _load_skills_config
|
||||||
skills_config = _load_skills_config().get("skills", {})
|
skills_config = _load_skills_config().get("skills", {})
|
||||||
@@ -3542,7 +3542,8 @@ class AIAgent:
|
|||||||
|
|
||||||
flush_content = (
|
flush_content = (
|
||||||
"[System: The session is being compressed. "
|
"[System: The session is being compressed. "
|
||||||
"Please save anything worth remembering to your memories.]"
|
"Save anything worth remembering — prioritize user preferences, "
|
||||||
|
"corrections, and recurring patterns over task-specific details.]"
|
||||||
)
|
)
|
||||||
_sentinel = f"__flush_{id(self)}_{time.monotonic()}"
|
_sentinel = f"__flush_{id(self)}_{time.monotonic()}"
|
||||||
flush_msg = {"role": "user", "content": flush_content, "_flush_sentinel": _sentinel}
|
flush_msg = {"role": "user", "content": flush_content, "_flush_sentinel": _sentinel}
|
||||||
@@ -4541,8 +4542,9 @@ class AIAgent:
|
|||||||
self._turns_since_memory += 1
|
self._turns_since_memory += 1
|
||||||
if self._turns_since_memory >= self._memory_nudge_interval:
|
if self._turns_since_memory >= self._memory_nudge_interval:
|
||||||
user_message += (
|
user_message += (
|
||||||
"\n\n[System: You've had several exchanges in this session. "
|
"\n\n[System: You've had several exchanges. Consider: "
|
||||||
"Consider whether there's anything worth saving to your memories.]"
|
"has the user shared preferences, corrected you, or revealed "
|
||||||
|
"something about their workflow worth remembering for future sessions?]"
|
||||||
)
|
)
|
||||||
self._turns_since_memory = 0
|
self._turns_since_memory = 0
|
||||||
|
|
||||||
@@ -4552,8 +4554,9 @@ class AIAgent:
|
|||||||
and self._iters_since_skill >= self._skill_nudge_interval
|
and self._iters_since_skill >= self._skill_nudge_interval
|
||||||
and "skill_manage" in self.valid_tool_names):
|
and "skill_manage" in self.valid_tool_names):
|
||||||
user_message += (
|
user_message += (
|
||||||
"\n\n[System: The previous task involved many steps. "
|
"\n\n[System: The previous task involved many tool calls. "
|
||||||
"If you discovered a reusable workflow, consider saving it as a skill.]"
|
"Save the approach as a skill if it's reusable, or update "
|
||||||
|
"any existing skill you used if it was wrong or incomplete.]"
|
||||||
)
|
)
|
||||||
self._iters_since_skill = 0
|
self._iters_since_skill = 0
|
||||||
|
|
||||||
|
|||||||
@@ -439,11 +439,13 @@ MEMORY_SCHEMA = {
|
|||||||
"Memory is injected into future turns, so keep it compact and focused on facts "
|
"Memory is injected into future turns, so keep it compact and focused on facts "
|
||||||
"that will still matter later.\n\n"
|
"that will still matter later.\n\n"
|
||||||
"WHEN TO SAVE (do this proactively, don't wait to be asked):\n"
|
"WHEN TO SAVE (do this proactively, don't wait to be asked):\n"
|
||||||
|
"- User corrects you or says 'remember this' / 'don't do that again'\n"
|
||||||
"- User shares a preference, habit, or personal detail (name, role, timezone, coding style)\n"
|
"- User shares a preference, habit, or personal detail (name, role, timezone, coding style)\n"
|
||||||
"- You discover something about the environment (OS, installed tools, project structure)\n"
|
"- You discover something about the environment (OS, installed tools, project structure)\n"
|
||||||
"- User corrects you or says 'remember this' / 'don't do that again'\n"
|
|
||||||
"- You learn a convention, API quirk, or workflow specific to this user's setup\n"
|
"- You learn a convention, API quirk, or workflow specific to this user's setup\n"
|
||||||
"- You identify a stable fact that will be useful again in future sessions\n\n"
|
"- You identify a stable fact that will be useful again in future sessions\n\n"
|
||||||
|
"PRIORITY: User preferences and corrections > environment facts > procedural knowledge. "
|
||||||
|
"The most valuable memory prevents the user from having to repeat themselves.\n\n"
|
||||||
"Do NOT save task progress, session outcomes, completed-work logs, or temporary TODO "
|
"Do NOT save task progress, session outcomes, completed-work logs, or temporary TODO "
|
||||||
"state to memory; use session_search to recall those from past transcripts.\n"
|
"state to memory; use session_search to recall those from past transcripts.\n"
|
||||||
"If you've discovered a new way to do something, solved a problem that could be "
|
"If you've discovered a new way to do something, solved a problem that could be "
|
||||||
|
|||||||
@@ -561,7 +561,8 @@ SKILL_MANAGE_SCHEMA = {
|
|||||||
"user-corrected approach worked, non-trivial workflow discovered, "
|
"user-corrected approach worked, non-trivial workflow discovered, "
|
||||||
"or user asks you to remember a procedure.\n"
|
"or user asks you to remember a procedure.\n"
|
||||||
"Update when: instructions stale/wrong, OS-specific failures, "
|
"Update when: instructions stale/wrong, OS-specific failures, "
|
||||||
"missing steps or pitfalls found during use.\n\n"
|
"missing steps or pitfalls found during use. "
|
||||||
|
"If you used a skill and hit issues not covered by it, patch it immediately.\n\n"
|
||||||
"After difficult/iterative tasks, offer to save as a skill. "
|
"After difficult/iterative tasks, offer to save as a skill. "
|
||||||
"Skip for simple one-offs. Confirm with user before creating/deleting.\n\n"
|
"Skip for simple one-offs. Confirm with user before creating/deleting.\n\n"
|
||||||
"Good skills: trigger conditions, numbered steps with exact commands, "
|
"Good skills: trigger conditions, numbered steps with exact commands, "
|
||||||
|
|||||||
Reference in New Issue
Block a user