> ## Documentation Index
> Fetch the complete documentation index at: https://codearchitect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# store_session

> Store AI conversation sessions as organized markdown files in topic-named folders

Store AI conversation sessions as organized markdown files in `~/.codearchitect/sessions/`. Creates a topic-named folder with `summary.md` and `full.md` files for better organization.

**Recommended workflow:** Export chat from Cursor/VS Code to `~/.codearchitect/exports/`, then call `store_session` without parameters - it will auto-detect the export file.

## Parameters

<ParamField body="conversation" type="string | Message[]">
  Optional. Conversation text or JSON array of messages. If not provided, tool automatically looks for export file in `~/.codearchitect/exports/`.
</ParamField>

<ParamField body="exportFilename" type="string">
  Optional. Pattern to match specific export file (case-insensitive). Example: `"resolve_mcp"` matches `cursor_resolve_mcp_configuration_issues.md` or `auth-implementation.json`. If not provided, uses newest export file (modified in last 10 minutes).
</ParamField>

<ParamField body="topic" type="string">
  Optional session topic. Auto-extracted if not provided.
</ParamField>

<ParamField body="format" type="string" default="plain">
  `"plain"` for text, `"messages"` for JSON array. Default: `"plain"`.
</ParamField>

<ParamField body="projectDir" type="string">
  Optional. Project directory path. If specified, saves to BOTH main folder (`~/.codearchitect/sessions/`) AND project folder (`project/.codearchitect/sessions/`). Always saves to main folder first.
</ParamField>

## Response

### Success

<ResponseField name="success" type="boolean" required>
  Always `true`.
</ResponseField>

<ResponseField name="summaryFile" type="string" required>
  Full path to `summary.md` file in topic folder.
</ResponseField>

<ResponseField name="fullFile" type="string" required>
  Full path to `full.md` file in topic folder.
</ResponseField>

<ResponseField name="filename" type="string" required>
  Topic folder name (e.g., `authentication-implementation`).
</ResponseField>

<ResponseField name="topic" type="string" required>
  Final topic used.
</ResponseField>

<ResponseField name="date" type="string" required>
  ISO date string.
</ResponseField>

<ResponseField name="message" type="string" required>
  Success message indicating folder location.
</ResponseField>

### Error

<ResponseField name="success" type="boolean" required>
  Always `false`.
</ResponseField>

<ResponseField name="error" type="string" required>
  Error code (see below).
</ResponseField>

<ResponseField name="message" type="string" required>
  Human-readable error message.
</ResponseField>

## Error Codes

| Code | Description |
| - | - |
| `NO_CONVERSATION_OR_EXPORT` | No conversation provided and no recent export file found |
| `INVALID_INPUT` | Missing or invalid conversation |
| `FILE_WRITE_ERROR` | Cannot write file |
| `DIRECTORY_CREATION_ERROR` | Cannot create directory |
| `UNKNOWN_ERROR` | Unexpected error |

## Examples

### Using Export File (Recommended)

<RequestExample>
  ```json theme={null}
  {
    "name": "store_session",
    "arguments": {}
  }
  ```
</RequestExample>

**Workflow:**

1. Export chat from Cursor/VS Code to `~/.codearchitect/exports/`
2. Call `store_session` without parameters
3. Tool auto-detects and processes export file

### With Explicit Topic

<RequestExample>
  ```json theme={null}
  {
    "name": "store_session",
    "arguments": {
      "topic": "Authentication Implementation"
    }
  }
  ```
</RequestExample>

### With Direct Conversation

<RequestExample>
  ```json theme={null}
  {
    "name": "store_session",
    "arguments": {
      "conversation": "User: Implement authentication\nAI: Let's use JWT...",
      "topic": "Authentication Implementation"
    }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "summaryFile": "/path/.codearchitect/sessions/2025-11-18/authentication-implementation/summary.md",
    "fullFile": "/path/.codearchitect/sessions/2025-11-18/authentication-implementation/full.md",
    "filename": "authentication-implementation",
    "topic": "authentication-implementation",
    "date": "2025-11-18T14:30:22.123Z",
    "message": "Session saved in folder authentication-implementation: summary.md and full.md"
  }
  ```
</ResponseExample>

## Storage Structure

Sessions are stored in topic-named folders with two files:

**Main location (always):** `~/.codearchitect/sessions/`

* Windows: `C:\Users\YourName\.codearchitect\sessions\`
* Linux/Mac: `~/.codearchitect/sessions/`

```
~/.codearchitect/sessions/
└── YYYY-MM-DD/
    └── topic-folder-name/
        ├── summary.md    # Short summary + detailed request/response pairs
        └── full.md       # Complete JSON messages + human-readable format
```

**Optional project location:** `project/.codearchitect/sessions/` (if `projectDir` specified)

**Folder naming:**

* Topic-based folder names (e.g., `authentication-implementation`)
* Redundant suffixes automatically removed (`-summary`, `-session`, `-conversation`, `-chat`)
* Auto-numbered if folder name collision occurs

**Files:**

* `summary.md`: Quick summary with key points and detailed request/response pairs
* `full.md`: Complete conversation as JSON (TOON-optimized) + human-readable format

## Limits

* **Conversation size**: Max 10MB (truncated to 1MB)
* **Topic length**: Max 100 chars (folder name sanitized)
* **Folder collisions**: Auto-numbered up to 1000 attempts

## Storage Behavior

**Main folder (always):** `~/.codearchitect/sessions/`

* Always saves here regardless of other settings
* Reliable location that works across all projects

**Project folder (optional):** `project/.codearchitect/sessions/`

* Only if `projectDir` parameter is explicitly provided
* Saves to both main folder AND project folder

**Export detection:** `~/.codearchitect/exports/`

* Tool automatically looks here for export files
* Supports both Cursor (`.md`) and VS Code (`.json`) formats


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.