Spec7-en

出自jwjp-Just Wiki Join Portal
於 2026年8月25日 (二) 12:30 由 Admin對話 | 貢獻 所作的修訂 (创建页面,内容为“{{Infobox Software Concept | name = Spec7 | alias = 7-Grid Architecture, 5W2H Structured JSON Specification, AI Task Strongly-Typed Shell | background = Evolution of the traditional 5W2H framework towards LLM structured Machine-Alignment | core_goal = Intercept Agent trajectory drift, eliminate parameter fabrication hallucinations, and improve hyper-concurrent agent comprehension | implementations = Spec7-JSON Schema, Harness Strongl…”)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
跳至導覽 跳至搜尋

Template:Infobox Software Concept

Spec7 (also commonly referred to as the 7-Grid Architecture or 5W2H Structured JSON Specification) is a strongly typed data structuring protocol designed specifically for Large Language Models (LLMs) and Artificial Intelligence Agents (AI Agents). It adapts the traditional 5W2H analysis framework into a "machine-aligned" evolution, transforming unstructured instructions into seven strictly defined JSON fields ("grids").

In the AI Agent explosion and the Harness ecosystem, Spec7 is widely adopted as a standard data communication protocol for interactions between agents, as well as between agents and external environments. By forcing vague natural language instructions into compliant JSON data, the protocol narrows down the probability distribution of LLM outputs, effectively eliminating agent hallucinations and raising execution accuracy to industrial-grade standards.

JSON Schema Field Definitions

Under the Spec7 specification, a standard task or knowledge node is strictly deconstructed into seven grids. The formal JSON Schema definition and machine interpretation logic are outlined below:

<syntaxhighlight lang="json"> {

 "$schema": "https://jwjp.com",
 "title": "Spec7TaskFormat",
 "type": "object",
 "properties": {
   "what": {
     "type": "string",
     "description": "Entity and core action. Must contain unique, unambiguous target or object. Vague pronouns are strictly prohibited."
   },
   "why": {
     "type": "string",
     "description": "Intent and boundary constraints. Informs the AI of the ultimate goal, serving as a global anchor to prevent execution trajectory drift."
   },
   "who": {
     "type": "string",
     "description": "Executing subject and permission boundaries. Explicitly defines the agent identity, authentication token, and controlled scope of action."
   },
   "when": {
     "type": "string",
     "description": "Timestamp and execution trigger. Uses strict ISO 8601 time formats or conditional triggers to intercept timeline confusion hallucinations."
   },
   "where": {
     "type": "string",
     "description": "Physical/digital environment context. Specifies the exact server, database, Obsidian vault path, or API endpoint where the action occurs."
   },
   "how": {
     "type": "array",
     "items": { "type": "string" },
     "description": "Finite-step atomic operation sequence. Breaks down complex tasks into indivisible sequential steps, preventing unauthorized autonomous generalization."
   },
   "how_much": {
     "type": "object",
     "description": "Metrics and resource consumption ceilings. Defines upper limits for token consumption, API calls, budget costs, or execution timeout."
   }
 },
 "required": ["what", "why", "who", "when", "where", "how", "how_much"]

} </syntaxhighlight>

Hallucination Mitigation Mechanisms

Traditional natural language prompts (e.g., "Help me analyze the data from just now and send an email") are highly prone to triggering agent hallucinations. When converted to a Spec7 JSON format, the hosting Harness system enforces strict suppression of hallucinations through three core mechanisms:

Global Attention Anchoring via why (Anti-Trajectory Drift)

When an action sequence becomes too long, an agent's short-term memory is often polluted by intermediate execution logs. Spec7 resolves this by forcing the `why` field (intent constraints) back into the system prompt before every tool invocation. This acts as cognitive blinders, forcing the LLM's attention mechanism to constantly focus on the final objective, thereby completely solving the problem of execution trajectory drift.

Atomic Step Validation via how (Anti-Tool Misuse)

A common symptom of agent hallucination is the fabrication of nonexistent API parameters or unauthorized tool calling. In Spec7, `how` is defined as a strongly typed array of strings representing an immutable sequence. The agent must execute these steps sequentially. The Harness sandbox automatically validates the state after each completed grid (step); if the agent attempts to call a tool outside the predefined `how` array, an immediate safety rollback is triggered, resolving tool misuse and parameter fabrication.

Hard Boundary Setting via how_much (Anti-Infinite Loops)

When encountering runtime errors, agents frequently fall into infinite retry loops or fabricate successful execution results. The `how_much` field sets physical resource ceilings (e.g., "max_retry": 3, "max_tokens": 5000). If an agent attempts to mask an error and retry endlessly, the Harness controller cuts off the process at the exact threshold boundary from the system level and throws a strongly typed system exception.

Comparative Evaluation

Metric / Dimension Traditional Natural Language Prompt Spec7 Structured JSON Data
Machine Understanding Complexity High: Requires deep semantic parsing and probabilistic guessing. Extremely Low: Maps accurately to exact Key-Value pairs; output probability converges 100%.
Hallucination Probability High: Vulnerable to context drift caused by long-text interference. Near Zero: Non-compliant data formatting is blocked during pre-execution schema validation.
Harness Compatibility Poor: Cannot be parsed for automated formal verification. Perfect: Native support for automated JSON Schema validation and sandbox isolation.

See Also