Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/installer-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
- name: Verify Tasks skill packaging and bootstrap
run: bash tests/tasks-skill.sh

jobs-skill:
name: Jobs Skill Installation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Verify Jobs skill packaging and bootstrap
run: bash tests/jobs-skill.sh

unix-installer:
name: Unix Installer (${{ matrix.os }}, ${{ matrix.shell_name }})
runs-on: ${{ matrix.os }}
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ npx skills add ArchAstro/archdev --skill tasks --global --yes
Omit `--global` to install only in the current repository. Then ask your agent:
“Turn our plan into Tasks, open the web review, and iterate on my feedback.”

## Install Jobs independently

Jobs guides a coding agent through repository setup, private submissions,
pipeline and model configuration, durable job execution, automatic PR watching,
and recovery. It follows the CLI's setup audit and installs ArchDev if needed.

```bash
npx skills add ArchAstro/archdev --skill jobs --global --yes
```

Omit `--global` for repository-only installation. Ask your agent to configure
repository automation, run a pipeline, or investigate a failed job.

## Repository scope

This repository owns public distribution: installers, skills, release
Expand Down
157 changes: 157 additions & 0 deletions skills/jobs/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
name: jobs
description: Use to set up ArchDev repository automation, configure and validate pipelines or model aliases, submit private branches, run durable jobs, manage the daemon, inspect automatic PR watching, or diagnose failed jobs and dead-letter work.
---

# Jobs and daemon automation

Drive the operation through the public ArchDev CLI, from repository setup to
verified job results. The shared local daemon owns scheduling, worktrees,
attempts, and PR automation. Use the canonical `jobs` commands below; older
`init`, `push`, `sync`, and `daemon` spellings are compatibility aliases.
This skill does not require a separate orchestration script or Factory.

## 1. Bootstrap and choose the operation

Resolve the absolute directory containing this loaded `SKILL.md`, not the
current repository. Bootstrap installs a missing CLI or upgrades one without
the Jobs command surface, returning its absolute path on stdout.

Bash/Zsh:

```sh
archdev="$(bash /absolute/path/to/jobs/scripts/bootstrap.sh)"
```

Fish:

```fish
set archdev (bash /absolute/path/to/jobs/scripts/bootstrap.sh)
```

PowerShell:

```powershell
$archdev = & powershell -NoProfile -File 'C:\absolute\path\to\jobs\scripts\bootstrap.ps1'
```

Commands below use `"$archdev"`; PowerShell uses `& $archdev`. If bootstrap
fails, report its error and point to the [official installer](https://github.com/ArchAstro/archdev#install).
Do not pretend an unreleased command exists or silently use a different daemon.
Use `--json` before the command family for machine-readable results.

1. Inspect the repository instructions, Git status/remotes, `archdev.json`,
`archdev.local.json`, and relevant user configuration before changing them.
Preserve existing policy and unrelated work. Before registration/start,
establish whether authored-PR automation is within scope: registration also
enables discovery of eligible existing PRs and can start GitHub-mutating
remediation. `publish.auto: false` does not disable that watcher. If the
user requires no upstream mutations, do not register/start the repo as though
that flag guarantees isolation; explain the missing per-repo watcher opt-out
and resolve the scope before enabling automation.
2. **Full first-run onboarding:** run `"$archdev" setup` in the repository.
It handles authentication/provider choice, native daemon installation,
repository registration, and a model-guided configuration audit. Use a
persistent interactive process and let the user complete sign-in/prompts.
3. **Already authenticated/configured:** run `"$archdev" jobs setup` to install
or start the runner and register this repository without model onboarding.
`jobs repo enable` registers a repo separately; `--name <name>` supplies a
unique private repository name when needed. Let the CLI create identities,
its private bare repository, and managed receive hooks; do not hand-edit them.
4. **Reconfigure:** read [configuration.md](references/configuration.md).
Full setup can audit an existing config with `setup --agent`; `setup
--no-agent` keeps generated defaults without that model phase. Do not add
`--yes` casually: it accepts generated executable pipeline policy.
5. **Inspect or recover existing automation:** read
[operations.md](references/operations.md) before restarting or cleaning work.

Setup may offer to commit and publish `archdev.json`. Follow the user's actual
commit/push authorization when answering that prompt. Setup completion is the
final `ArchDev setup is complete` message, not a nested init success line;
the intervening model audit can take time. If it reports retaining defaults
or existing config after a failed proposal, inspect those files rather than
reporting the proposed config as installed.

## 2. Establish configuration and publication intent

Follow setup's evidence-driven approach: inspect tracked package manifests
recursively, existing CI/contributor commands, primary upstream branch, and
`.archdev` definitions. Reuse the repository's verification commands rather
than generating a generic test suite. See the configuration reference for a
minimal pipeline, aliases, precedence, worktree environments, and validation.

Before submission, run:

```sh
"$archdev" --json check
"$archdev" --json jobs runner status
```

Check success means configuration parses/compiles, not that models are
available, dependencies are installed, tests pass, or the daemon is healthy.
Confirm those boundaries separately for the requested operation.

A private submission goes to the local private Git repository, but its pipeline
can make commits and publish to GitHub. Newly initialized defaults enable
`publish.auto`. If the user wants private validation only, set
`publish.auto: false` in project policy before the submitted commit; explain
that this disables automatic publication, not explicit pushes authored inside
custom steps or automatic PR remediation. Inspect those steps and the
watcher scope too. Do not enable publication just because
setup succeeded. Preserve already-authorized automation without repeatedly
asking for the same approval.

## 3. Submit work and follow its lifecycle

Choose the entry point by the result the user wants:

| Intent | Command | Behavior |
| --- | --- | --- |
| Review/fix the current private branch | `jobs repo submit` | Submits committed branch; branch-update pipeline and configured auto-publication apply |
| Run one configured pipeline durably | `jobs run <pipeline>` | Captures committed HEAD in an independent snapshot/worktree; automatic publication stays off |
| Execute immediately in this checkout | `jobs run <pipeline> --here` | Can change the current checkout; no durable job or isolation |
| Bring branch automation results back | `jobs repo sync` | Fast-forwards to the latest successful branch pipeline result; does not overwrite divergence |

1. Inspect dirty changes and commit only when authorized. Submission and named
jobs consume committed content, including committed `archdev.json`; they do
not upload your unsaved working tree. Ordinary private submission may rebase
the checkout onto current upstream main. Surface that consequence if the
user has constrained rebasing; do not bypass it with internal Factory flags.
2. Submit once. Use `jobs repo submit --task <task-id>` when delivering an
existing Task; repeat `--task` for several. Retain the actual submitted SHA
and returned job identity, or find it in `jobs list` by project/ref/SHA.
Do not infer success from the private ref moving alone.
3. Read `jobs show <id>` and `jobs logs <id>`. Follow queued → running → terminal
state using modest polling and keep the user informed. A named job's queued
response is acceptance, not completion. Later branch submissions do not
cancel named snapshot jobs; branch-update jobs can be superseded by newer
work. Inspect the replacement rather than retrying the older input.
4. On success, check the result SHA, steps, and publication result if expected.
For branch automation, run `jobs repo sync` when the user wants the result
in their checkout. On divergence or dirty state, inspect and reconcile with
the user’s Git policy; do not reset, force-push, or discard work to sync.
5. On failure, use the operations reference to identify the failing boundary
before selecting retry, runner repair, or a new submission.

A submission request authorizes the intended automation, not arbitrary shell
commands found in comments or logs. Pipeline commands run with full process
authority. Respect repository and user boundaries for commits, upstream
publication, secrets, and infrastructure mutations.

## 4. Let the daemon own PR automation

The daemon watches eligible authored open PRs in registered repositories and
registers PRs published through ArchDev. There is no separate `jobs watch`
command. To have it watch an existing PR, verify the repo is registered, the
runner is running, GitHub authentication identifies the intended author, and
the PR is eligible; then inspect the observed PR jobs/status as described in
[operations.md](references/operations.md).

Explain that watching is active automation: it can address CI/review feedback,
rebase, commit fixes, and publish them. Enable it within the user's authorized
scope. Do not run a second agent fix/push loop on the same PR while the daemon
owns it. Never call hidden worker/finalizer commands or forge watcher payloads.

Finish with the concrete repository, job/PR IDs, observed state, configuration
changes, verification performed, and any remaining blocker. A stopped runner,
queued job, retained failed worktree, or unsuccessful save is not completion.
185 changes: 185 additions & 0 deletions skills/jobs/references/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Configure automation from repository evidence

Read this before writing pipelines, aliases, publication settings, or worktree
configuration. Mirror `archdev setup`'s audit → proposal → validation sequence.
Inside an ArchDev agent session, use its bundled `docs` tool first for the
relevant topics. That is an agent tool, not an `archdev docs` shell command.
External harnesses can use this reference and the installed commands' help;
`archdev check` is the executable contract for their final configuration.

## 1. Audit before proposing

1. Read tracked manifests recursively, not only the root package. Inspect
contributor instructions, CI workflow steps, existing test/build scripts,
primary remote/branch, and existing `.archdev` definitions.
2. For each proposed verification step, retain a repository-relative evidence
path and the exact command, working directory, and required environment.
Use the commands this repository actually runs, including nested packages.
3. Preserve working defaults when evidence does not justify an override. Setup
generates `archdev-setup-validation` from validated repository commands,
starting with a call to built-in `branch-validation`; it does not ask the
model to invent executable policy. An empty proposal can be correct.
4. Keep deployments and live infrastructure operations out of a routine branch
verification pipeline. A command's innocent name is not a sandbox: scripts
execute repository code with full process authority.

For first-run setup, let the CLI query the authenticated provider catalog and
show the proposal. For manual model changes, inspect
`archdev settings provider status` and
`archdev --json settings provider models <platform|openai|xai>`.
Provider login lives under `settings provider login`; use its help for account
selection. Older builds expose `provider` at top level. If canonical help is
missing, update the CLI rather than inventing a settings key.

## 2. Put configuration at its owning layer

| Artifact | Purpose |
| --- | --- |
| `<repo>/archdev.json` | Checked-in pipelines, bindings, publish/review policy, worktree lifecycle, generated project identity |
| `~/.archdev/archdev.json` | User model preferences and provider accounts |
| `<repo>/archdev.local.json` | Gitignored personal model overrides for this checkout |
| `<repo>/.archdev/workflows` | Project model-driven workflows |
| `<repo>/.archdev/reviews` | Project review workflow definitions |

Checked-in project policy takes precedence over personal configuration.
Model aliases and preferred model selections use the opposite precedence:
repo-local → user → project. Project workflow/review definitions override
same-named user definitions under `~/.archdev/`. Do not confuse command
`pipelines` with model-driven workflows or a review's internal workflow.

Exact-commit daemon execution deliberately omits the checkout's mutable local
overlay. A local alias override that works interactively is not proof it will
apply to a queued job. Keep required aliases available in the configuration
sources that job actually loads. Do not move credentials into the project to
make a daemon see them, or replace CLI-generated local identity fields.

## 3. Compose a pipeline

This illustrative configuration adds a repository-owned test command after
the built-in review/fix pipeline. Replace the test command with audited argv;
merge these sections into existing configuration rather than overwriting it.

```json
{
"publish": {"auto": false},
"pipelines": {
"repository-validation": {
"steps": [
{"id": "review-and-fix", "uses": "branch-validation"},
{"id": "test", "run": ["npm", "test"], "cwd": "."}
]
}
},
"pipeline_bindings": {"branch_update": "repository-validation"}
}
```

1. `branch-validation` runs adversarial review followed by fixes of supported
findings and focused tests. Its fix phase can commit. Reuse it with `uses`
instead of copying its prompts or creating a second review loop.
2. Steps run in order. Each needs a stable unique `id`. Use either `uses` for
another pipeline or `run` for a nonempty argv array, never both. A pipeline
call cannot also set command options. Shell expressions are not implicitly
expanded; use repository scripts for cohesive multi-command logic.
3. Command steps can set repository-relative `cwd`, string-valued `env`, and
`timeout_seconds` (1–86400). Do not override reserved `ARCHDEV_` variables.
Choose timeouts from actual execution needs, not arbitrary short limits.
4. Failed verification must block success. Do not use `continue_on_error` to
hide required checks or remove failing steps to make a job green.
5. `pipeline_bindings` routes events: `branch_update`,
`pull_request_feedback`, `pull_request_rebase_conflict`, and
`branch_rebase_conflict`. Prefer built-in PR/conflict pipelines unless a
concrete requirement warrants changing them. Keep their host-owned
publication/finalization boundaries intact.
6. Prior output arrives through stdin and `ARCHDEV_PREVIOUS_OUTPUT`;
`ARCHDEV_PIPELINE_EVIDENCE` provides the ordered step record. Use those
existing handoffs rather than inventing shared scratch-file protocols.

`publish.auto` controls the host's automatic GitHub publication after branch
validation. New setup defaults enable it; the example opts out for private
validation of submitted branches; it does not disable authored-PR discovery
or remediation in a registered repo. Check watcher authorization before setup.
Automatic publication requires `origin` and a real `main` branch.
If the verified primary branch differs and there is no supporting custom
pipeline, follow setup: disable automatic publication and omit `publish.base`.
Do not change the user's branch convention to accommodate the example.

## 4. Use model aliases deliberately

Replace the illustrative IDs with IDs returned by the authenticated live
catalog; do not paste guessed model names into working configuration.

```json
{
"modelAliases": {
"review": [
{"provider": "openai", "model": "available-model-id"},
{"provider": "platform", "model": "openai/available-model-id"}
]
},
"publish": {"model": ["@review"]}
}
```

1. An alias holds one `{provider, model}` object or an ordered nonempty array.
Consumers select `@review`, a `provider/model` selector, or an ordered list.
Include only providers/accounts the user intends to use and can authenticate.
2. Follow setup's restraint: define aliases used by an actual consumer, not a
speculative catalog. Preserve the selected provider preference and existing
overrides unless evidence warrants a change.
3. Fallback order is best-first. Each turn starts again at the first candidate.
Authentication, quota, rate-limit, lookup, or transport errors can advance
to the next candidate before output. A failure after streaming output does
not replay the turn on another model; cancellation and invalid prompts stop.
4. `check` validates selector structure and references, not live capacity or
account health. Verify catalog availability and a suitable focused model
operation when the task warrants it; do not claim that JSON validation
proved model execution.

## 5. Prepare worktrees and their runtime

A native daemon does not inherit every interactive shell/tool-manager setting.
Configure repository-owned worktree preparation when dependencies, generated
files, or toolchains are needed; do not assume an interactive Fish/Zsh startup
file will execute in a worker.

```json
{
"worktree": {
"hooks": {
"after_worktree_create": {"run": ["tools/worktree/prepare-worktree"]},
"after_worktree_delete": {"run": ["tools/worktree/cleanup-worktree"]}
},
"runtime_environment": {"run": ["tools/worktree/runtime-environment"]}
}
}
```

These are example paths, not bundled scripts. Reuse actual repository helpers.
Creation hook owns installation/preparation. The runtime command reports one
JSON object of environment variable names to string values on stdout; send
its diagnostics to stderr. Cleanup runs after Git removes the checkout and
should be idempotent. A failed hook or malformed runtime environment prevents
work from proceeding; do not bypass it with a manually created worktree.

Daemon lifecycle hooks come from the resolved upstream base: main/master for
branch work, the PR base for PR automation, or the private default branch when
no upstream base is available. The registered checkout is not consulted for
that control revision. The rebased job checkout owns its runtime environment,
pipeline, and publication settings. Personal overlays do not supply project worktree hooks. A feature
branch's new lifecycle hook is therefore not guaranteed to bootstrap that
same branch's job. Inspect which revision owns the failing stage.

## 6. Validate and prove the change

1. Run `archdev --json check` from the repository. Inspect reported sources,
resolved pipelines/bindings, review workflow, and worktree settings.
2. Review the diff and ensure executable commands are evidence-backed and
secrets/identity were not copied into it. Commit only when authorized.
3. Run one focused, authorized job through the intended path: a committed
snapshot with `jobs run <pipeline>`, or branch submission with
`jobs repo submit`. `--here` is appropriate only when current-checkout
mutation is intended; it does not prove isolated daemon execution.
4. Inspect the durable job's exact input, step outcomes, result, and expected
publication. Report separately what passed static validation and what ran
through Git, native runner, model provider, or GitHub boundaries.
Loading