Appearance
CI/CD with KSCM
Overview
The KSCM CLI makes it straightforward to automate build and validation pipelines by creating workspaces on demand, keeping long-lived workspaces for incremental builds, and syncing to the latest revisions. It also supports workspace stashes that can be retrieved, tested, and updated as part of your CI process. Attachments let you publish CI artifacts, summaries, and reviews directly on repo changelists, workspace changelists, and stashes. Secondary file servers can be used as local caches near your build agents to speed up syncs and reduce WAN traffic, and LLM-assisted workflows can generate and attach documentation automatically.
This document describes common CI/CD patterns and how to express them with KSCM commands, including attachments and LLM automation.
Building blocks
Use these commands as the foundation for automation:
create-workspace/delete-workspacefor ephemeral build agents.create-workspacefor long-lived, incremental build sessions (reuse the same workspace across jobs).syncto bring a workspace to the latest revision.history,show-revision,list-changelists,show-changelistto inspect changes and determine which tasks to run.stash-changelist,list-stashes(for example with--tags),show-stash,retrieve-stash,edit-stashto find stashes to test (for example, stashes tagged with a build machine name), retrieve them, run validation, then update the stash metadata with the results.list-attachments,upload-attachment,download-attachment,delete-attachmentto publish CI artifacts, summaries, or reviews directly on repo changelists, workspace changelists, and stashes.clean-workspaceto reset a workspace to a pristine state when needed.
Pattern: ephemeral workspaces
For clean builds, create a workspace, sync to the latest revision, run the pipeline, then delete the workspace.
text
# Create a workspace for a build agent
kscm create-workspace --name:CI-Agent-01 --path:/build/agent01 --repomap:Main
# Sync to the latest revision
kscm sync --workspace:CI-Agent-01
# Run build/test steps...
# Delete the workspace when the job is done
kscm delete-workspace --workspace:CI-Agent-01Pattern: long-lived workspaces for incremental builds
Incremental builds are more efficient when the workspace is kept alive across jobs. Create the workspace once, then reuse it for rapid syncs and repeated operations.
text
# Create a long-lived workspace for a build agent (done once)
kscm create-workspace --name:CI-Agent-LongLived --path:/build/agent-longlived --repomap:Main
# In subsequent jobs, sync and build against the long-lived workspace
kscm sync --workspace:CI-Agent-LongLivedThis pattern is ideal for continuous integration systems that run frequently and benefit from preserving intermediate build artifacts.
Detecting tasks through changelist tags
Pipelines often need to decide which jobs to run based on metadata in a changelist. If your workflow uses tags in changelist descriptions or metadata, query the changelist and route tasks accordingly.
Example approach:
- Use
list-changelists(optionally with--tags) to identify relevant changelists. - Use
show-changelistto read descriptions or tag metadata. - Map tags to pipeline tasks (e.g.,
build,tests,package).
text
kscm list-changelists --workspace:CI-Agent-LongLived --tags:build,tests
kscm show-changelist --workspace:CI-Agent-LongLived --clid:123Validating stashed changelists
Stashes are useful for CI validation before submitting changes. A common flow is:
- Create or update a stash for a changelist.
- Load the stash into a validation workspace.
- Run validation tasks.
- Clean the workspace after validation.
text
# Find stashes to validate (for example, tagged for a specific build machine)
kscm list-stashes --workspace:CI-Validation --scope:remote --tags:ci-agent-01
# Retrieve a stash into a validation workspace
kscm retrieve-stash --id:1030 --workspace:CI-Validation --boundcl:new --conflicts:backup
# Run validation tasks...
# Clean workspace after validation
kscm clean-workspace --workspace:CI-ValidationAttachments for CI artifacts
Attachments are a simple way to share build artifacts (logs, reports, binaries, screenshots, and more) directly on repo changelists, workspace changelists, and stashes. They are ideal for CI pipelines that want to keep outputs close to the code review context.
There are no limitations on attachment sizes, so pipelines can publish large artifacts when needed.
Note: This is a good fit for Unreal Engine precompiled binaries, which are often large but useful for downstream teams.
Using LLMs to generate docs, summaries, and reviews
Kimura SCM's skill pack gives an LLM the context it needs to turn a natural-language request into safe, concrete kscm commands. The LLM performs the reasoning and document generation; KSCM performs the workspace inspection and SCM operations.
The resulting summaries, reviews, and risk notes can be attached to repo changelists, workspace changelists, or stashes so that the analysis stays with the work it describes.
Default skills
The default skill pack includes:
kscm-cli: maps task requests to valid KSCM commands, options, and workflows.kscm-cl-compare: compares two KSCM artifacts and generates a summary, review, risk note, or requested custom document. It can also attach the result when requested.
These skills are intentionally basic. Teams can customize them, combine them with other skills, or create project-specific variants.
Ways to access the skills
The same default skill pack is available through several access paths:
Installed files: the Windows installer places each
SKILL.mdunderskills/<skill-name>/in the Kimura SCM installation directory. The macOS installer places them under/Library/Application Support/KimuraSCM/skills/<skill-name>/, and the Ubuntu package places them under/usr/share/kimurascm/skills/<skill-name>/. Assistant tools can load those files directly.Embedded CLI resources: each
kscmexecutable embeds the default skill files. Use the following command to export them:textkscm export-skills --destination:./.codex/skillsThe command always exports the complete skill pack embedded in the current KSCM executable and replaces existing skill files with that version.
MCP: when
kscmruns in MCP mode,export-skillsis available as an MCP tool. This lets an MCP client materialize the embedded pack without shelling out to a separate CLI process.Repository source: developers can read and customize the source files under
.codex/skills/before packaging or exporting them.
Choosing a workflow
Use the regular CLI for one-shot commands and CI steps that already have a shell environment. Use kscm mcp when an assistant or automation host will make several related calls and benefit from a persistent KSCM process.
The kscm-cl-compare workflow accepts two supported sources, such as:
- a submitted repo changelist from
show-revision; - a workspace changelist from
show-workspace-cl --ops:true; - a stash or stash revision from
show-stash.
The LLM should identify both sources, collect their operation or revision details, generate the requested document, and confirm the attachment target before uploading unless the workflow already specifies it.
Example workflows
Review a submitted repo changelist and attach the review to that repo changelist:
text
kscm show-revision --clid:1756 --workspace:CI-Agent
# generate the review from the inspected changelist
kscm upload-attachment --target:repo --clid:1756 --file:cl-1756-review.md --workspace:CI-AgentReview a remote stash selected by a tag, attach the result, and mark it reviewed:
text
kscm list-stashes --workspace:CI-Validation --scope:remote --tags:nr
kscm show-stash --id:<stash-id> --scope:remote --workspace:CI-Validation
# generate the review
kscm upload-attachment --target:stash --id:<stash-id> --stash-scope:remote --file:stash-<stash-id>-review.md --workspace:CI-Validation
kscm edit-stash --id:<stash-id> --description:"... #reviewed" --scope:remote --workspace:CI-ValidationGenerate separate summary and risk documents for a workspace changelist:
text
kscm show-workspace-cl --clid:1827 --ops:true --workspace:CI-Agent
# generate the summary and risk note
kscm upload-attachment --target:workspace-cl --clid:1827 --file:cl-1827-summary.md --workspace:CI-Agent
kscm upload-attachment --target:workspace-cl --clid:1827 --file:cl-1827-risk.md --workspace:CI-AgentCI-friendly workflow pattern
A repeatable CI workflow is:
- Find work items that need analysis, often by filtering stash or changelist tags.
- Inspect the selected artifact and collect the relevant operations or revision data.
- Generate the requested summary, review, risk note, or custom document.
- Write the document to a known local path.
- Upload it with the correct attachment target and scope.
- Update a tag, such as
#nrto#reviewed, so the same item is not processed repeatedly.
For unattended jobs, keep the source selector, attachment target, output filename, and tag transition explicit. Do not infer a remote stash scope or upload target when more than one interpretation is possible.
Cleaning and resetting workspaces
CI pipelines often require clean state. Use clean-workspace to reset a workspace to a pristine state that matches the latest revision (or a specific revision with --clid).
text
kscm clean-workspace --workspace:CI-Agent-LongLivedSecondary file servers for faster syncs
To reduce network load, configure a secondary file server that is local to your CI environment. This allows workspaces to sync files from a nearby cache instead of repeatedly pulling large file sets over the WAN.
When creating a workspace, specify the secondary file server name and endpoint for the local cache server:
text
kscm create-workspace --name:CI-Agent-01 --path:/build/agent01 --repomap:Main \
--secondaryfsname:FS-LOCAL --secondaryfsendpoint:localhost:9000This is especially useful for build farms or distributed CI setups where many agents pull the same content repeatedly.
Summary
The KSCM CLI supports CI/CD workflows that range from clean, ephemeral builds to long-lived, incremental pipelines. By combining workspace hosting, fast syncs, changelist-driven routing, stash validation, and secondary file servers, you can build efficient automation that scales with your build infrastructure.
