Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Freshness Gate

agent-freshness-gate is a small, dependency-free Python reference for a single pre-execution question:

Is the context, scope, and authority still current for this specific action?

It accepts a plain JSON handoff record and returns either proceed or review, together with the exact reasons a human should recheck the request. It does not call tools, send messages, store data, or make external changes.

Living Memory then Proactive Execution: retained context can prepare a proposal, but it cannot advance one unless the source, requested scope, and exact approval remain current.

What it checks

  • The source revision still matches the revision used to prepare the action.
  • Context has not exceeded its declared freshness window.
  • The requested scope still matches the recorded scope.
  • Approval exists, has not expired, and covers the requested action and scope.
  • An external commitment has an action-specific approval.

Example

{
  "context": {
    "captured_at": "2026-08-27T14:00:00Z",
    "max_age_seconds": 3600,
    "source_version": "session-42:v3",
    "current_source_version": "session-42:v3",
    "scope": "launch-plan",
    "requested_scope": "launch-plan"
  },
  "authority": {
    "state": "approved",
    "action": "prepare_draft",
    "approval_for": "prepare_draft",
    "approval_scope": "launch-plan",
    "expires_at": "2026-08-27T16:00:00Z",
    "external_commitment": false
  }
}
PYTHONPATH=src python -m agent_freshness_gate examples/handoff.json \
  --now 2026-08-27T14:30:00Z
{
  "decision": "proceed",
  "next_safe_step": "perform the bounded action and save a result receipt",
  "reasons": []
}

If a source changed, a context window expired, a scope differs, or approval no longer covers the action, the decision becomes review. This keeps a plausible summary from being mistaken for permission to continue.

Run tests

PYTHONPATH=src python -m unittest discover -s tests -v

Relationship to Klik

This educational reference was authored by Chengyi Xu. Klik is a pre-launch, app-first, recorder-agnostic proactive-AI direction centered on deliberate Sessions, persistent Context, and permission-aware follow-through. This library is not a Klik release, integration, support guarantee, benchmark, security certification, or claim that every recorder, model, or tool is supported.

Learn about Klik's pre-launch direction:

https://pre.hiklik.ai/?utm_source=github&utm_medium=developer_library&utm_campaign=kickstarter_prelaunch&utm_content=memory_control_matrix_20260901

Discover Klik: https://pre.hiklik.ai/

Memory control matrix: retention is not authority

Chat history and selected memory can be useful evidence for a next step. Neither should silently become permission to act. This small matrix makes the distinction inspectable before an agent proceeds:

Control Ask before reuse Gate consequence
Source Which conversation, note, or system produced this item? Recheck when the source revision changed.
Freshness What could have changed since capture? Return review after the declared context window expires.
Scope Does this item still belong to this person, project, and task? Return review when the requested scope differs.
Control Can the person inspect, correct, remove, or limit the retained item? Keep the item reviewable; do not treat a summary as a final record.
Authority Does using it require new access, material judgment, or an external commitment? Require action-specific human approval.

This reference does not collect chat history, persist memory, or grant authority. It only evaluates the handoff data supplied by its caller. A useful retained fact can prepare a next step; it cannot replace a person’s decision to authorize one.

About

A dependency-free reference evaluator for fresh, scoped, authorized agent handoffs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages