gstack icon indicating copy to clipboard operation
gstack copied to clipboard

Natural-language skill triggers are stored in triggers: but not folded into descriptions

Open jinzheio opened this issue 5 months ago • 4 comments

What I observed

The README says gstack skills support natural/voice-friendly trigger phrases:

gstack skills have voice-friendly trigger phrases. Say what you want naturally — "run a security check", "test the website", "do an engineering review" — and the right skill activates.

Source: README.md, Voice input section.

But most skill templates declare those phrases in a normal triggers: frontmatter field, while the generation pipeline only folds voice-triggers: into description:.

On current main (11de390b, v1.58.5.0), I counted:

  • 56 SKILL.md.tmpl files with triggers:
  • 20 SKILL.md.tmpl files with voice-triggers:
  • 0 code paths that fold ordinary triggers: into description:

The implemented folding path is specific to voice-triggers:

  • scripts/gen-skill-docs.ts has extractVoiceTriggers() / processVoiceTriggers().
  • processVoiceTriggers() appends Voice triggers (speech-to-text aliases): ... to the description.
  • The function returns unchanged when there is no voice-triggers: field.

That means phrases under normal triggers: stay as metadata. For hosts that discover skills from name + description, those phrases are not part of the matching surface.

Why this matters

Claude/OpenAI-style skill discovery appears to rely on name + description, not arbitrary extra frontmatter fields.

The repo already reflects that model in the Codex host config:

frontmatter: {
  mode: 'allowlist',
  keepFields: ['name', 'description'],
  descriptionLimit: 1024,
  descriptionLimitBehavior: 'error',
}

So for Codex/OpenAI output, triggers: is explicitly dropped. For Claude Code, even if the raw field remains in the file, the always-loaded catalog/triggering surface is still the description. The repo's own catalog trim also moves routing prose out of frontmatter after the lead sentence.

This creates a mismatch:

  • README promises natural phrases activate the right skill.
  • Templates contain those phrases, but mostly under triggers:.
  • The generator only preserves voice-triggers: in description:.
  • External host metadata uses the post-processed description, so ordinary triggers are invisible there too.

Concrete example

qa/SKILL.md.tmpl has useful triggers like:

triggers:
  - qa test this
  - find bugs on site
  - test the site
voice-triggers:
  - quality check
  - test the app
  - run QA

Only the voice-triggers values are appended to the description. The normal triggers values are not.

Expected behavior

Either:

  1. Fold selected triggers: phrases into the generated description: / Codex openai.yaml short description, similar to voice-triggers, or
  2. Rename the intended model-visible field and migrate templates so trigger phrases that should affect skill selection live in description: / voice-triggers:, or
  3. Document that triggers: is only for gstack's own router/browser-skill metadata and does not affect Claude/Codex skill discovery.

My guess is option 1 was intended, because processVoiceTriggers() already implements the exact mechanism, but only for voice-triggers:.

Suggested test coverage

Add a generator test that fails if a skill template has triggers: but the generated host-visible description/metadata has none of the expected trigger intent. A minimal version could assert that a fixture with triggers: emits a Use when asked to... line in generated Codex/Claude descriptions, subject to the existing description length limit.

jinzheio avatar Jun 26 '26 12:06 jinzheio

Follow-up after upgrading the Codex global install to v1.58.5.0 (11de390b): this still reproduces for ordinary triggers:.

What changed:

  • The root gstack skill is now correctly generated as a router. That part is fixed in v1.58.5.0 and is separate from this issue.
  • Codex-installed SKILL.md files no longer contain raw triggers: or voice-triggers: in frontmatter, which is expected because the Codex host keeps only name + description.
  • voice-triggers: are folded into description:.
  • Ordinary triggers: still are not systematically folded into description: or agents/openai.yaml metadata.

Concrete example after install:

qa/SKILL.md.tmpl contains both:

voice-triggers:
  - "quality check"
  - "test the app"
  - "run QA"
triggers:
  - qa test this
  - find bugs on site
  - test the site

Generated Codex gstack-qa/SKILL.md includes the voice-trigger line in description:, but the ordinary triggers: values are only represented if the hand-written description already happens to repeat them.

I also did a rough exact-string check against the installed Codex skills: 54 installed gstack skills come from templates with triggers:, and 14 of them have zero ordinary trigger phrases appearing verbatim in the generated description. Some are semantically covered by nearby wording, but the generator is not preserving the field as a model-visible trigger surface.

So the issue is still current after v1.58.5.0; it is not the same as the root-router fix.

jinzheio avatar Jun 26 '26 12:06 jinzheio

I think this is a strong case for treating skill invocation metadata as a contract, not just loose frontmatter.

The problem seems to be that gstack has at least three routing surfaces:

triggers:
  useful authoring metadata

voice-triggers:
  currently folded into description

description:
  actual host-visible routing surface for Claude/Codex/OpenAI-style skill discovery

If a host only keeps name + description, then triggers: is effectively invisible unless the generator folds selected phrases into the host-visible description.

A standard AISP-style package could make this explicit by separating canonical invocation metadata from host-specific exports:

[
  {
    "role": "system",
    "content": {
      "protocol": "AISP V1.0.0",
      "axiom_0": "Human_Sovereignty_and_Wellbeing",
      "id": "gstack_skill_invocation_export_aisp",
      "name": "gstack Skill Invocation Export Contract",
      "version": "1.0.0",
      "license": "MIT",
      "summary": "Machine-checkable contract for exporting natural-language triggers into host-visible skill descriptions.",
      "description": "Ensures canonical triggers and voice triggers are preserved or explicitly mapped into host-visible description fields for hosts that only route by name and description.",
      "flow_format": "mermaid",
      "loading_mode": "node",
      "tools": ["filesystem"],
      "params": {
        "skill_template_path": "string",
        "host": "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": "host_export_validation",
          "when_to_use": [
            "before generating host-specific SKILL.md files",
            "before generating Codex/OpenAI skill metadata",
            "when a skill template contains triggers or voice-triggers"
          ],
          "when_not_to_use": [
            "skills with no natural-language trigger metadata",
            "internal templates not exported to an agent host"
          ]
        },
        "non_negotiable": [
          {
            "rule": "If a host routes only by name and description, selected natural-language triggers must be folded into the generated description or explicitly documented as non-routing metadata.",
            "enforced_by": "export.step3:sys.assert"
          },
          {
            "rule": "Host-specific generated descriptions must respect the host description length limit.",
            "enforced_by": "validate.step2:sys.assert"
          },
          {
            "rule": "The generator must not silently drop routing intent from triggers.",
            "enforced_by": "validate.step3:sys.assert"
          }
        ],
        "discovery": {
          "category": "skill_generation",
          "tags": ["gstack", "skills", "triggers", "description", "codex", "host-export", "aisp"]
        },
        "risk_level": "medium",
        "resources": [
          {
            "id": "skill_template",
            "path": "{skill_template_path}",
            "kind": "template",
            "mode": "read_only",
            "when": "Read before host-specific skill generation.",
            "scope": "skill"
          }
        ]
      },
      "aisop": {
        "main": "graph TD\n    load[Load skill template] --> extract[Extract invocation metadata]\n    extract --> export[Generate host-visible description]\n    export --> validate[Validate routing preservation]\n    validate --> trace[Record export trace]\n    trace --> end_node((End))"
      },
      "functions": {
        "load": {
          "step1": "sys.io.read(skill_template_path) -> skill_template",
          "output_mapping": "skill_template"
        },
        "extract": {
          "step1": "Extract name, description, triggers, voice-triggers, and host export profile.",
          "output_mapping": "invocation_metadata"
        },
        "export": {
          "step1": "For hosts that keep only name and description, fold selected triggers and voice-triggers into the generated description.",
          "step2": "For hosts that support richer metadata, preserve triggers in the host-supported field.",
          "step3": "sys.assert('routing intent is represented in host-visible metadata', 'Natural-language trigger intent was dropped during export')",
          "output_mapping": "generated_host_metadata"
        },
        "validate": {
          "step1": "Check generated description length against host profile.",
          "step2": "sys.assert('description length within host limit', 'Generated host description exceeds limit')",
          "step3": "sys.assert('trigger intent preserved or explicitly documented as non-routing', 'Trigger metadata invisibly dropped')",
          "output_mapping": "host_export_validation"
        },
        "trace": {
          "step1": "Record template path, host, trigger count, folded trigger count, description length, and validation status.",
          "output_mapping": "skill_export_trace"
        },
        "end_node": {
          "step1": "Return host_export_validation and skill_export_trace."
        }
      }
    }
  }
]

This does not require adopting AISP in gstack. The practical fix can stay inside gen-skill-docs.ts:

1. Treat triggers and voice-triggers as canonical invocation metadata.
2. For hosts that only keep name + description, fold selected trigger intent into description.
3. Add a generator test that fails if a template has triggers but generated host-visible metadata contains none of that routing intent.
4. Keep description length limits enforced per host.

The important invariant is:

routing metadata that affects skill selection must survive host export.

optimization2026 avatar Jun 30 '26 05:06 optimization2026

Thanks for this. The blocker is that ordinary triggers and voice aliases currently serve different purposes, while exporting every trigger could increase routing ambiguity and catalog size. Please narrow this to a documentation correction or specify selective, deduplicated export limits with ambiguity checks for each host.

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

Thanks @jinzheio. Decision: later. Folding triggers: into the host-visible descriptions conflicts with the catalog trim and would regenerate every skill, so we'll revisit a bounded when_to_use: key after the catalog byte budget and #3129 settle.

In the meantime, a README fix is coming that describes triggers: accurately, as router metadata rather than host-visible voice input. Leaving this open for the revisit.

capy-ai[bot] avatar Oct 17 '26 16:10 capy-ai[bot]