gstack icon indicating copy to clipboard operation
gstack copied to clipboard

System diagnostics ⚠ Large ~/.claude/skills/gstack/CLAUDE.md will impact performance (58.5k chars > 40.0k)

Open idourra opened this issue 5 months ago • 4 comments

Once I installed gstack and begin to work I found this message from claude code System diagnostics ⚠ Large ~/.claude/skills/gstack/CLAUDE.md will impact performance (58.5k chars > 40.0k)

idourra avatar Jun 23 '26 14:06 idourra

But how is it working so far?

Bigmanbiggiey avatar Jun 24 '26 08:06 Bigmanbiggiey

This warning points at a progressive-disclosure problem.

A large always-loaded CLAUDE.md / gstack preamble becomes expensive even when the user asks a small question.

The skill should probably be split into:

always-loaded core:
  routing
  safety-critical rules
  update check summary
  tiny command map

on-demand references:
  full CLI docs
  routing details
  team mode
  gbrain
  telemetry
  artifacts sync
  model overlays
  host-specific setup

A standard AISP-style package could express this as a resource-loading contract:

[
  {
    "role": "system",
    "content": {
      "protocol": "AISP V1.0.0",
      "axiom_0": "Human_Sovereignty_and_Wellbeing",
      "id": "gstack_preamble_progressive_disclosure_aisp",
      "name": "gstack Preamble Progressive Disclosure Contract",
      "version": "1.0.0",
      "license": "MIT",
      "summary": "Machine-checkable contract for shrinking always-loaded gstack context and loading long references only when needed.",
      "flow_format": "mermaid",
      "loading_mode": "node",
      "tools": ["filesystem"],
      "params": {
        "user_task": "string",
        "gstack_root": "string"
      },
      "system_prompt": ""
    }
  },
  {
    "role": "user",
    "content": {
      "instruction": "STRICTLY OBEY aisp_contract; its non_negotiable rules are inviolable; then RUN aisop.main",
      "user_input": "{user_input}",
      "aisp_contract": {
        "profile": "aisp.skill.v1",
        "invocation": {
          "mode": "context_budget_management",
          "when_to_use": [
            "before building always-loaded gstack context",
            "when generated CLAUDE.md or SKILL.md exceeds host size threshold",
            "when a small support task would otherwise load the full gstack manual"
          ],
          "when_not_to_use": [
            "explicit deep documentation request",
            "developer task already scoped to a reference file"
          ]
        },
        "non_negotiable": [
          {
            "rule": "Do not load all gstack reference material by default.",
            "enforced_by": "select_reference.step2:sys.assert"
          },
          {
            "rule": "Always-loaded context must stay under the configured host threshold.",
            "enforced_by": "budget.step2:sys.assert"
          },
          {
            "rule": "Safety-critical rules must remain visible in the compact core.",
            "enforced_by": "core.step2:sys.assert"
          }
        ],
        "discovery": {
          "category": "context_management",
          "tags": ["gstack", "claude", "context-budget", "progressive-disclosure", "aisp"]
        },
        "risk_level": "medium",
        "resources": [
          {
            "id": "routing_reference",
            "path": "references/routing.md",
            "kind": "reference",
            "mode": "read_only",
            "when": "Load when routing details are needed.",
            "scope": "skill"
          },
          {
            "id": "team_mode_reference",
            "path": "references/team-mode.md",
            "kind": "reference",
            "mode": "read_only",
            "when": "Load when team installation or CLAUDE.md repo integration is discussed.",
            "scope": "skill"
          },
          {
            "id": "gbrain_reference",
            "path": "references/gbrain.md",
            "kind": "reference",
            "mode": "read_only",
            "when": "Load when memory sync or gbrain behavior is needed.",
            "scope": "skill"
          }
        ]
      },
      "aisop": {
        "main": "graph TD\n    core[Load compact core] --> classify[Classify task]\n    classify --> budget[Check context budget]\n    budget --> select_reference[Select needed references]\n    select_reference --> answer[Answer with minimal context]\n    answer --> trace[Record loaded context]\n    trace --> end_node((End))"
      },
      "functions": {
        "core": {
          "step1": "Load compact gstack core instructions only.",
          "step2": "sys.assert('core contains routing and safety-critical rules', 'Compact core must retain critical rules')",
          "output_mapping": "core_context"
        },
        "classify": {
          "step1": "Classify user_task as routing, setup, team_mode, gbrain, artifacts, upgrade, safety, or other.",
          "output_mapping": "task_classification"
        },
        "budget": {
          "step1": "Estimate always-loaded context size.",
          "step2": "sys.assert('always-loaded context below host threshold', 'Always-loaded gstack context exceeds threshold')",
          "output_mapping": "context_budget_status"
        },
        "select_reference": {
          "step1": "Select the minimal reference set needed for task_classification.",
          "step2": "sys.assert('not all references selected by default', 'Do not load all gstack references by default')",
          "output_mapping": "selected_references"
        },
        "answer": {
          "step1": "Answer using core_context and selected_references only.",
          "output_mapping": "response"
        },
        "trace": {
          "step1": "Record core size, selected references, estimated tokens, and reason for loading.",
          "output_mapping": "context_loading_trace"
        },
        "end_node": {
          "step1": "Return response and context_loading_trace."
        }
      }
    }
  }
]

The immediate fix could be:

1. Move long preamble branches into references/.
2. Keep routing + safety-critical rules in the always-loaded core.
3. Add a size budget check for generated CLAUDE.md/SKILL.md.
4. Add trace/debug output showing which references were actually loaded.

The key invariant:

default context should be a router, not the whole manual.

optimization2026 avatar Jun 30 '26 05:06 optimization2026

@idourra The generated CLAUDE.md remains above the 40k-character performance threshold, so the excessive skill context size is unresolved.

time-attack avatar Jul 15 '26 22:07 time-attack

Fixed in v1.91.16.0 (#3014, ac20ef1): CLAUDE.md is now about 32K characters (under Claude Code's 40,000-character warning), with a size tripwire test; contributor detail moved to docs.

Thanks for the report! If it still happens on v1.91.16.0 or later, reply here and we'll reopen.

capy-ai[bot] avatar Oct 03 '26 14:10 capy-ai[bot]