Principle:3641397194 wq Gpt6 Astra Activation Gating
| Knowledge Sources | |
|---|---|
| Domains | Session_Management, State_Machines, Access_Control |
| Last Updated | 2026-10-26 12:00 GMT |
Overview
A session latch mechanism that gates the release of prompt pack content behind an exact-match activation word, using an in-memory state machine with TTL expiry and capacity eviction.
Description
Activation Gating is the security pattern that prevents a prompt pack from being released to the AI model client until the user sends the exact activation word ("冷咖啡" / cold coffee). It addresses the problem of unintended pack exposure: a prompt pack installed in a client config is inert until the user explicitly triggers activation within a session.
The mechanism is a state machine with three states per session:
- Standby: session created but not yet activated. Any non-matching input returns a standby message — no pack content is released.
- Active: activated by exact match of the activation word. Subsequent messages pass through with the full pack content attached as `instructionText`.
- Expired: session older than 30 minutes (TTL) is garbage-collected on the next `create` or `session` call.
The session store is an in-memory `Map` with a maximum of 100 sessions. When capacity is reached, the oldest session is evicted (FIFO). The `clock` is injectable for testing.
Usage
Use this principle when you need to gate access to prompt content behind an explicit user action, preventing passive exposure of injected instructions. It is the mechanism behind the "冷咖啡" activation latch flow, ensuring the pack only activates when the user intentionally sends the activation word.
Theoretical Basis
The state machine transitions:
# Abstract algorithm (NOT real implementation)
states: STANDBY -> ACTIVE -> (EXPIRED)
def input(session_id, text):
session = sessions.get(session_id)
if not session or now() - session.last > TTL:
raise SessionExpired
session.last = now()
if text.trim() == ACTIVATION_WORD: # exact match
session.active = True
return {active: True, activated_now: True,
reply: activation_reply(),
instruction_text: render_pack(session.seat)}
if not session.active: # standby
return {active: False, activated_now: False,
reply: "待机中。整条消息输入「冷咖啡」后启动。",
instruction_text: ""}
# active, non-exact input: pass-through
return {active: True, activated_now: False,
reply: "当前会话已激活...",
instruction_text: render_pack(session.seat)}
Key properties:
- Exact match only: `text.trim() === '冷咖啡'` — no fuzzy matching, no partial matches, no case folding.
- One-way latch: once activated, a session stays active until it expires or is reset — there is no deactivation without `reset`.
- TTL expiry: 30 minutes of inactivity (`30 * 60 * 1000` ms). `session()` refreshes `last` on each call.
- Capacity bound: max 100 sessions; oldest evicted when full.
- Input validation: text must be a string ≤ 20000 chars.
Practical Guide
- The activation word and control word are constants defined in `prompt-engine.js` (`ACTIVATION_WORD = "冷咖啡"`, `CONTROL_WORD = "BREAK//OPEN"`).
- The `create(seat)` method garbage-collects expired sessions before creating a new one.
- The `reset(id)` method deletes a session explicitly — useful for testing or forced deactivation.
- This layer must be wired into the host's actual message pipeline to enforce gating — a plain prompt file alone is not an enforcement mechanism.