gstack icon indicating copy to clipboard operation
gstack copied to clipboard

Allow artifacts to be created in the project repo intended by the author

Open nsangwan opened this issue 5 months ago • 3 comments

  Artifacts:
  - Design doc amended, review report terminal: ~/.gstack/projects/...
  - Test plan (consumed by /qa): ~/.gstack/projects/...
  - 11 build tasks: ~/.gstack/projects/...

CC verified -

Because that's where the gstack skills are hardcoded to write, not a choice I made per file.

  Every gstack skill (/office-hours, /plan-eng-review, /qa, etc.) keys its artifacts to a per-project directory at
  ~/.gstack/projects/{slug}/, where the slug is derived from your directory name. The design doc, review report, test
  plan, task JSONL, decision log, and learnings all land there. That's the convention baked into the skill instructions; the skill tells
  me the exact path to write to.
...
A symlink from the repo into ~/.gstack/ would technically work locally but it's an absolute path under your home dir — useless to
  anyone who clones, and bad to commit. Not worth it.

@garrytan perhaps allow the user to choose if skills should write to the project folder or the ~/.gstack/ path.

nsangwan avatar Jun 14 '26 06:06 nsangwan

This is an artifact routing contract issue.

Artifact output should distinguish:

gstack internal artifacts
  logs, traces, internal state

project-authored artifacts
  design docs, QA reports, screenshots, plans, release notes, diagrams

If the user/skill author intends an artifact to live in the project repo, the runtime should support that explicitly rather than forcing everything into a gstack-owned location.

A standard AISP-style contract could express the artifact destination:

[
  {
    "role": "system",
    "content": {
      "protocol": "AISP V1.0.0",
      "axiom_0": "Human_Sovereignty_and_Wellbeing",
      "id": "gstack_project_artifact_routing_aisp",
      "name": "gstack Project Artifact Routing Contract",
      "version": "1.0.0",
      "license": "MIT",
      "summary": "Machine-checkable contract for routing skill artifacts to project repo or gstack internal storage.",
      "flow_format": "mermaid",
      "loading_mode": "node",
      "tools": ["filesystem"],
      "params": {
        "artifact_kind": "string",
        "artifact_path": "string",
        "project_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": "artifact_routing",
          "when_to_use": [
            "before writing skill-generated artifact",
            "when artifact is intended for project repo",
            "when artifact destination is ambiguous"
          ],
          "when_not_to_use": [
            "pure internal logs",
            "temporary scratch output"
          ]
        },
        "non_negotiable": [
          {
            "rule": "Project-authored artifacts must be allowed inside declared project paths.",
            "enforced_by": "route.step2:sys.assert"
          },
          {
            "rule": "Internal gstack state must not be mixed with project-authored artifacts.",
            "enforced_by": "classify.step2:sys.assert"
          },
          {
            "rule": "Artifact path must stay inside declared allowed root.",
            "enforced_by": "write.step2:sys.assert"
          }
        ],
        "discovery": {
          "category": "artifact_management",
          "tags": ["gstack", "artifacts", "project-root", "reports", "aisp"]
        },
        "risk_level": "medium",
        "resources": [
          {
            "id": "project_root",
            "path": "{project_root}",
            "kind": "repository",
            "mode": "read_only",
            "when": "Read before artifact path validation.",
            "scope": "skill"
          }
        ]
      },
      "aisop": {
        "main": "graph TD\n    classify[Classify artifact] --> route[Select destination root]\n    route --> validate[Validate path]\n    validate --> write[Write artifact]\n    write --> trace[Record artifact trace]\n    trace --> end_node((End))"
      },
      "functions": {
        "classify": {
          "step1": "Classify artifact_kind as internal_state, report, plan, screenshot, diagram, release_note, or scratch.",
          "step2": "sys.assert('internal and project artifacts are distinguished', 'Artifact class must be explicit')",
          "output_mapping": "artifact_classification"
        },
        "route": {
          "step1": "Route project-authored artifacts to declared project_root when intended by user or skill.",
          "step2": "sys.assert('project artifact destination is allowed', 'Project-authored artifact should be allowed in project repo')",
          "output_mapping": "artifact_destination"
        },
        "validate": {
          "step1": "Normalize artifact_path and ensure it stays inside selected destination root.",
          "output_mapping": "path_validation"
        },
        "write": {
          "step1": "Write artifact to validated path.",
          "step2": "sys.assert('artifact path stays inside allowed root', 'Artifact write path escaped allowed root')",
          "output_mapping": "write_result"
        },
        "trace": {
          "step1": "Record artifact kind, destination, path, and reason.",
          "output_mapping": "artifact_routing_trace"
        },
        "end_node": {
          "step1": "Return artifact_routing_trace."
        }
      }
    }
  }
]

The key invariant:

project deliverables should be first-class project artifacts;
internal state should remain internal.

optimization2026 avatar Jun 30 '26 06:06 optimization2026

@16francej — recommend closing this issue as a duplicate of #1161. #1161 more fully covers repository-local authored artifacts and the user, repository, or dual-location policy, while separating deliverables from private operational state. Please preserve #2000's per-artifact classification comment and reporter attribution without turning it into a blanket state move.

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

Shipped in fork-port wave 2: design docs and review artifacts now land in the project repo the author intended, written as decision records — same feature closes #703. Plan-review skills discover repo-local docs through one shared resolver.

Commits: 4a34bd7d feat(office-hours): design docs land in the repo, written as decision records (#703, #2000); 808344ec (shared discovery resolver). Pinned by: the template carve-guards (test/helpers/carve-guards.ts via test/carve-guard-completeness.test.ts).

Ships in #2577 (v1.65.0.0).

garrytan avatar Aug 15 '26 15:08 garrytan