bootstrap-memory-ingest-cloud

$npx mdskill add Fr-e-d/GAAI-framework/bootstrap-memory-ingest-cloud

Ingests synthesized memory entries into Cloud workspace via MCP tool.

  • Persists validated memory entries from bootstrap-llm-synthesis into the Cloud workspace.
  • Depends on gaai_memory.store MCP tool with source='bootstrap'.
  • Loops over entries and calls the tool per entry, tracking success and failure counts.
  • Returns ingest_result with success_count, fail_count, and errors array.

SKILL.md

.github/skills/bootstrap-memory-ingest-cloudView on GitHub ↗
---
name: bootstrap-memory-ingest-cloud
description: Write structured memory entries to the Cloud workspace via gaai_memory.store MCP tool with source='bootstrap'. Loops over entries from bootstrap-llm-synthesis, calls the tool per entry, collects success/fail counts. Used as Stage 5 of the /gaai:bootstrap pipeline (Cloud path only).
license: ELv2
compatibility: Requires GAAI Cloud MCP connection with bootstrap_status=in_progress in the target workspace
metadata:
  author: gaai-framework
  version: "1.0"
  category: cross
  track: cross-cutting
  id: SKILL-BOOTSTRAP-MEMORY-INGEST-CLOUD-001
  updated_at: 2026-05-01
  status: stable
inputs:
  - synthesis_result          # output of bootstrap-llm-synthesis (entries[], parse_errors[])
outputs:
  - ingest_result             # { success_count, fail_count, errors[] }
skills_invoked:
  - SKILL-BOOTSTRAP-MEMORY-INGEST-CLOUD-001
---

# Bootstrap Memory Ingest — Cloud

## Purpose / When to Activate

Activate:
- As Stage 5 of the `/gaai:bootstrap` pipeline, **Cloud path only**
- After `bootstrap-llm-synthesis` (Stage 3) has produced validated memory entries
- When the workspace bootstrap_status is `in_progress` (set by the bootstrap orchestrator)
- Do NOT activate if the workspace bootstrap_status is anything other than `in_progress` — the server gate will refuse all writes

## Pre-conditions

Before activating, verify:
1. The GAAI Cloud MCP session is active
2. `synthesis_result.entries` is non-empty
3. workspace `bootstrap_status` = `in_progress` (checked implicitly by the server gate — no pre-flight check needed)

## Process Steps

### Loop: for each entry in synthesis_result.entries

1. **Call** `gaai_memory` MCP tool:
   ```json
   {
     "action": "store",
     "scope": "ws",
     "category": "<entry.category>",
     "topic": "<entry.topic>",
     "content": "<entry.content>",
     "tags": ["<entry.tags...>"],
     "source": "bootstrap"
   }
   ```

2. **On success** (`result.action` = `"created"` or `"updated"`):
   - Increment `success_count`
   - Log entry: `[OK] <category>/<topic> → <action>`

3. **On error** (response has `isError: true` or contains `code` field):
   - Increment `fail_count`
   - Capture error: `{ category, topic, code, error }`
   - Log entry: `[FAIL] <category>/<topic> → <code>: <error>`
   - **Continue to next entry** — per-entry errors never abort the loop

### After loop: produce ingest_result

```json
{
  "success_count": <N>,
  "fail_count": <M>,
  "errors": [
    { "category": "...", "topic": "...", "code": "...", "error": "..." }
  ]
}
```

Report summary to user:
- `"Bootstrap ingest complete: {success_count} written, {fail_count} failed"`
- If `fail_count > 0`: list the failed entries with their error codes

## Server-Side Gate Behavior (AC6)

The `source: 'bootstrap'` parameter activates the server-side bootstrap gate on each write:

| Condition | Server response |
|---|---|
| `bootstrap_status = 'in_progress'` AND category not blocked | Write proceeds (HTTP 200 / MCP success) |
| `bootstrap_status != 'in_progress'` | `code: BOOTSTRAP_NOT_ACTIVE` |
| `category = 'decisions'` (any topic) | `code: BOOTSTRAP_CATEGORY_BLOCKED` |
| `category = 'rules'` AND `topic` starts with `active.` | `code: BOOTSTRAP_CATEGORY_BLOCKED` |

**Blocked categories are not writeable by bootstrap.** Entries with `code: BOOTSTRAP_CATEGORY_BLOCKED` are per-entry failures — increment `fail_count` and continue.

## Audit Events (AC3)

For each successful write with `source: 'bootstrap'`, the server emits a `memory.bootstrap.ingest` audit event:
- `action`: `"memory.bootstrap.ingest"`
- `resource`: `"memory"`
- `target`: `"<category>/<topic>"`
- `verdict`: `"OK"`
- `details.entry_action`: `"created"` or `"updated"`

This event is emitted server-side — no client-side action required.

## Dedup Behavior (AC2)

Re-running bootstrap (re-calling this skill with the same category+topic) does NOT produce duplicates.
The HMAC-based dedup in `StructuredMemory.store()` treats a second write as an `updated` action on the existing row. The `ingest_result.success_count` will reflect this as a successful write.

## Non-Goals (Out of Scope)

- **LLM inference**: This skill does NOT call the LLM. Call `bootstrap-llm-synthesis` first.
- **Consent gate**: This skill does NOT show the consent overlay. That is a later pipeline stage.
- **Local OSS path**: This skill is Cloud-native only. For local-only bootstrap, entries are written to `.gaai/project/contexts/memory/` filesystem directly by the bootstrap orchestrator.
- **Error recovery**: Per-entry errors are logged and skipped. No retry logic. If `fail_count > 0`, the operator should review the errors and re-run if needed.
- **Status transition**: This skill does NOT change `bootstrap_status`. The orchestrator transitions `in_progress → done` after the consent stage.

More from Fr-e-d/GAAI-framework

SkillDescription
abort-safe-handlerOrchestrator-level Stage 4 entry gate for /gaai:bootstrap. Presents a pre-loop "Skip Q&A entirely" option, delegates to qa-loop-ui when the user proceeds, and returns a unified abort_safe_result with telemetry on every path. Guarantees no partial state on skip or abort.
ambiguity-detectorTakes surface scan results, optional LLM synthesis open-question entries, and optional tree-sitter AST signals to score project ambiguities (1-10). Outputs structured ambiguity_feed for smart-question-generator. Pure heuristic — no LLM calls. Designed for Stage 3.5 of the /gaai:bootstrap pipeline (between LLM synthesis and Q&A).
approach-evaluationResearch industry standards and best practices, identify viable approaches for a given technical or architectural problem, and produce a structured factual comparison against project-specific constraints. Reports options — does not decide.
architecture-extractConvert raw project structure into clear architectural understanding — module boundaries, data flows, service relationships, and architectural patterns. Activate after codebase-scan during Bootstrap.
bootstrap-llm-synthesisConstruct the LLM synthesis prompt from project surface scan + optional tree-sitter context + optional Q&A answers. Call the LLM. Parse and validate the response into 6-8 structured memory entries with clarity tags and source traceability. Used as Stage 3 of the /gaai:bootstrap pipeline.
browser-journey-testValidate user stories by simulating real user journeys in a live browser against deployed application. Activate after implementation to verify actual user experience against acceptance criteria, not just code logic.
build-agents-indexScan all agent and sub-agent definition files in .gaai/core/agents/, extract YAML frontmatter, merge with specialists.registry.yaml, and generate a derived agents-index.yaml at .gaai/core/agents/agents-index.yaml. Activate after adding, modifying, or removing any agent, sub-agent, or specialist entry.
build-skills-indexScan SKILL.md files in .gaai/core/skills/ and .gaai/project/skills/, extract YAML frontmatter, and regenerate separate skills indices for each layer. Core index ships with the OSS framework; project index is project-specific.
ci-watch-and-fixWatch GitHub Actions CI after PR creation, detect failures, extract logs, apply minimal fixes, and re-push — keeping the delivery session alive until CI resolves or escalating after 3 cycles. Activate immediately after gh pr create and before marking the story done.
codebase-scanCreate a high-level map of the project structure and identify architectural pillars, entry points, and module boundaries. Activate at Bootstrap initialization or before architecture extraction.