refactor(agent): gate sustained goals behind explicit /goal
Replace the legacy long-goal skill contract with command-scoped goal tools and runtime guidance. Keep goal state durable across continuations while restricting create and replace mutations to explicit user /goal turns.
This commit is contained in:
1 parent
edf78e7054
commit
7f8c3453e1
24 files changed
+1131
-375
No files matched your search
@@ -0,0 +1,29 @@
|
||||
"""Turn-local permission for explicit sustained-goal mutations."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
from contextvars import ContextVar
|
||||
|
||||
_GOAL_MUTATION_ALLOWED: ContextVar[bool] = ContextVar(
|
||||
"nanobot_goal_mutation_allowed",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def goal_mutation_allowed() -> bool:
|
||||
return _GOAL_MUTATION_ALLOWED.get()
|
||||
|
||||
|
||||
def revoke_goal_mutation_permission() -> None:
|
||||
_GOAL_MUTATION_ALLOWED.set(False)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def goal_mutation_permission(allowed: bool):
|
||||
"""Bind goal permission for one agent-run or direct tool execution scope."""
|
||||
token = _GOAL_MUTATION_ALLOWED.set(allowed)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
_GOAL_MUTATION_ALLOWED.reset(token)
|
||||
Reference in new issue
Block a user