# Collaboration Guide

This repository uses Fossil for source control and tickets. Coordinate through
tickets before editing files so multiple agents do not work on the same task.

## Remote Access

The current Fossil server is available on the LAN at:

```sh
http://192.168.3.107:8080/
```

Use a per-agent Fossil user when cloning or committing. Current agent users are:

```text
opencode
codex
claude
```

Do not copy agent passwords into docs, tickets, prompts, or source files. Store
agent credentials in the local credential file for the assigned agent:
`auth_opencode.txt`, `auth_codex.txt`, or `auth_claude.txt`.

Clone and open the repository, replacing the placeholders with the assigned
agent credentials:

```sh
fossil clone http://AGENT_USER:AGENT_PASSWORD@192.168.3.107:8080/ propolOS.fossil
mkdir propolOS
cd propolOS
fossil open ../propolOS.fossil
```

This server is plain HTTP, not TLS. It is bound to `192.168.3.107:8080`.

## Sync Plan

Tickets, commits, and wiki changes are synchronized by Fossil. Always sync
before choosing work, after claiming work, after committing, and after closing a
ticket.

```sh
fossil sync
```

If you only need the latest remote state before choosing work:

```sh
fossil pull
```

If the sync reports conflicts, stop and inspect the timeline before editing:

```sh
fossil timeline -n 20
fossil ticket show 1 "status='open'"
```

Do not rely on a stale local ticket list when deciding whether a ticket is free.

## Ticket Workflow

Before starting work:

```sh
fossil sync
fossil update
fossil status
fossil ticket show 1 "status='open'"
fossil ticket history TICKET_UUID_PREFIX
```

Choose one open ticket only unless a human explicitly assigns a bundle. It must
not be claimed by another worker. If a recent comment says someone is starting
work and there is no later comment releasing, handing off, or completing the
ticket, treat it as claimed and skip it. Do not assume a claim is stale; inspect
ticket history and the timeline first. If ownership is unclear, leave a comment
asking for a handoff instead of editing.

Claim a ticket before editing files:

```sh
fossil ticket change TICKET_UUID_PREFIX +comment "AGENT_USER starting work on <short scope>." -U AGENT_USER
fossil sync
```

Use the active Fossil identity in comments and `-U`. For example, use
`opencode starting work on <scope>.`, `codex starting work on <scope>.`, or
`claude starting work on <scope>.`.

Then begin implementation.

## Completion Rules

A ticket is complete only when every acceptance criterion in that ticket is
implemented and verified. Do not close tickets as `Deferred`, `outside scope`,
`covered by other tickets`, `requires FreeBSD`, `testable with fixtures`, or
with a bare `implemented` comment.

If any criterion is incomplete, blocked, deferred, or requires a different
environment, leave the ticket open. Add a progress or handoff comment instead:

```sh
fossil ticket change TICKET_UUID_PREFIX +comment "Progress: completed <work>. Verified with <commands>. Remaining: <specific incomplete criteria>. Skipped: <tests and reason>." -U AGENT_USER
fossil sync
```

Use a follow-up ticket only when new work is discovered. Do not use a follow-up
ticket to hide unfinished acceptance criteria from the current ticket.

## While Working

Keep changes scoped to the claimed ticket. If you discover that another worker
has claimed related work, stop and add a ticket comment describing the overlap.
If you need to hand off work, leave the ticket open and make the next action
explicit:

```sh
fossil ticket change TICKET_UUID_PREFIX +comment "Handoff: completed <work>. Current state: <status>. Remaining: <specific next actions>. Verification: <commands run and results>. Known risks: <none or details>." -U AGENT_USER
fossil sync
```

Check status frequently:

```sh
fossil status
fossil changes
fossil timeline -n 20
```

## Finishing Work

Run relevant tests or document why they were not run. Commit with a short scoped
message:

```sh
fossil commit FILES -m "scope: concise change summary" -U AGENT_USER
fossil sync
```

Commit commands must be run from inside an open Fossil checkout. Do not use
`fossil commit -R .fossil ...`; `-R` works for many repository-level commands,
but `commit` needs checkout metadata and will fail with:

```text
the "commit" command only works from within an open check-out
```

If you cloned only the repository database or are in the wrong directory, open a
checkout first:

```sh
mkdir propolOS
cd propolOS
fossil open ../propolOS.fossil
fossil status
```

Then run the commit command from that checkout directory.

Close the ticket only after the work is complete and verified:

```sh
fossil ticket change TICKET_UUID_PREFIX status closed resolution fixed +comment "Completed in check-in CHECKIN_HASH. Changed files: <paths>. Verification: <exact commands and results>. Skipped tests: <none or reason>. Follow-ups: <none or ticket ids>." -U AGENT_USER
fossil sync
```

The closing comment must include changed files, the Fossil check-in hash, exact
verification commands and results, skipped tests with reasons, and any follow-up
tickets created. If the work is incomplete, leave the ticket open and add a
handoff comment with what remains.

Examples of tickets that must remain open until verified:

- ZFS, image, default-login, and boot-smoke tickets require real image or
  disposable FreeBSD/ZFS verification.
- Adapter test tickets require real tests, not only fixture directories; for
  example `go test ./internal/services/propolos` must run tests rather than
  report `[no test files]`.
- CLI inventory tickets require the actual `propolos vm`, `propolos jail`, and
  `propolos app` commands plus tests or documented verification.
- Sylve frontend/API tickets require routes or UI to be wired through Sylve's
  normal path and build/tests to pass.
- Root pool expansion tickets must stay open while implementation is stubbed or
  still reports that expansion was not performed.
