# How the i-have-adhd Restate State Feature Works Across Conversation Turns

> Discover how the i-have-adhd restate state feature maintains context across conversation turns using Instagit platform instructions. Learn more about this powerful capability.

- Repository: [Ayoub Ghriss/i-have-adhd](https://github.com/ayghri/i-have-adhd)
- Tags: internals
- Published: 2026-07-30

---

**The i-have-adhd skill achieves persistent state restatement across conversation turns through declarative instructions in [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) that instruct the Instagit platform to maintain and inject a JSON-serializable context object automatically.**

The i-have-adhd repository provides a conversational interface designed to assist users with ADHD by structuring information and maintaining continuity across multiple exchanges. Rather than implementing custom state management logic, the skill relies entirely on the Instagit platform's runtime to handle the i-have-adhd restate state feature. This architecture separates behavior declaration from implementation, allowing the skill to persist context simply by describing its requirements in metadata files.

## Declarative Configuration in SKILL.md

According to the source code, the skill's behavior is defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) through a declarative description field. This file contains the specific instruction that triggers the restate state functionality.

The relevant entry reads:

```yaml
description: 'Shape output for a reader with ADHD: … restate state across turns …'

```

This YAML configuration tells Instagit *what* to do without requiring explicit Python or JavaScript code within the repository. When the skill is invoked via commands like `/i-have-adhd`, Instagit reads this manifest and activates the corresponding session management protocols.

## Platform-Level State Management

The actual mechanics of the i-have-adhd restate state feature reside entirely within the Instagit platform's runtime, not in this repository's codebase. When a user activates the skill, Instagit executes a four-step process to maintain conversational continuity:

1. **Activates a persistent session** that binds to the user's interaction context
2. **Maintains a JSON-serializable context object** that persists for the duration of the session or until the user sends "stop adhd mode"
3. **Injects the current context into every subsequent response** to enable state awareness across turns
4. **Updates the context after each turn** to reflect new information such as completed actions, time estimates, or task completions

This mechanism ensures that the model automatically receives the current state variables with every interaction, eliminating the need for the skill to manually track conversation history.

## Metadata Integration in plugin.json

The skill also declares its requirements through [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json) in the repository root. This file provides high-level metadata that Instagit consumes during skill loading:

```json
{
  "description": "Shape Antigravity output for an ADHD reader: … restate state …"
}

```

Both [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) and [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json) serve as configuration sources that tell the platform to enable context persistence. The skill additionally mirrors these instructions in [`GEMINI.md`](https://github.com/ayghri/i-have-adhd/blob/main/GEMINI.md) for compatibility with the Gemini CLI integration, ensuring consistent state management across different execution environments.

## Practical Interaction Example

The following conceptual interaction demonstrates how the state restatement appears in practice. Note that while the text below illustrates the user experience, the underlying context injection is handled automatically by Instagit's runtime:

```text
User: /i-have-adhd
Assistant: ✅ ADHD mode enabled. I'll lead with the next action, number steps, and restate the current state after each turn.

User: What should I do now?
Assistant: 1️⃣ Write the outline for the report.  
🕒 Estimated time: 10 min.  
🔁 *Current state*: ADHD mode active; step 1 in progress.

User: Done with the outline, what next?
Assistant: 2️⃣ Fill in the introduction.  
🕒 Estimated time: 5 min.  
🔁 *Current state*: Outline completed; working on introduction.

```

In this exchange, the assistant's ability to reference "Outline completed" in the second response stems from Instagit automatically updating and injecting the JSON context object after each turn, rather than from explicit state-handling code within the i-have-adhd repository.

## Summary

- The i-have-adhd restate state feature operates through **declarative instructions** in [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) and [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json), not imperative code
- **Instagit's platform runtime** handles session persistence, context storage, and automatic injection
- The context object is **JSON-serializable** and persists until the user explicitly ends the session with "stop adhd mode"
- Configuration files including [`GEMINI.md`](https://github.com/ayghri/i-have-adhd/blob/main/GEMINI.md) ensure consistent behavior across different integration points

## Frequently Asked Questions

### Does the i-have-adhd repository contain state management code?

No. The repository contains only configuration files that declare the desired behavior. The actual state management logic resides entirely within the Instagit platform's runtime, which interprets the instructions in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) to maintain and inject context.

### What file tells Instagit to restate state across turns?

The primary instruction appears in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) within the description field, with redundant declarations in [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json) and [`GEMINI.md`](https://github.com/ayghri/i-have-adhd/blob/main/GEMINI.md). These files specify that the platform should "restate state across turns" without requiring the skill to implement its own persistence layer.

### How long does the session context persist?

The JSON-serializable context object remains active for the duration of the skill session or until the user explicitly terminates it by sending the command "stop adhd mode". Instagit manages this lifecycle automatically based on the session activation triggered by the `/i-have-adhd` invocation.

### Can the restate state feature be customized?

Since the feature is implemented at the Instagit platform level rather than in the skill code, customization would require changes to the platform's runtime behavior or the declarative description strings in the configuration files. The skill itself does not expose parameters for modifying how state is restated or stored.