---
title: "Workflows & Tutorials"
source: "https://edawise.com/docs/cli/workflows/"
---

# Workflows & Tutorials

This guide covers step-by-step recipes for common tasks with `deccy`.

---

## 1. Recording a New Decision

### Create a decision that claims existing files

When the files already exist in your working tree, pass one or more `--claim` (`-p`) flags:

```sh
deccy new -d -t text -T "Isolate CLI flag parsing in src/flags.rs" \
  -p src/flags.rs \
  -p tests/m6_cli.rs
```

`deccy` hashes each file, verifies no other node claims it, writes `.deccy/nodes/<id>.json`, and prints the new 32-character node ID.

### Create a decision and scaffold new empty files

If you are planning a decision before writing the code, add `--create` (`-C`). `deccy` will create any absent claim files as empty files (provided their parent directories exist):

```sh
mkdir -p src/verbs
deccy new -d -t text -T "Add hash verb for standalone blob digests" \
  -p src/verbs/hash.rs --create
```

### Attach rationale prose at creation time

Pass `--rationale <file>` (`-r <file>`) to copy prose from an existing file, or `-r -` to read prose from standard input:

```sh
deccy new -d -t adr -T "Use BLAKE3 with domain separation" -r - <<'EOF'
Every digest prepends an explicit ASCII domain tag ("deccy-blob\n",
"deccy-node\n", or "deccy-id\n") so blob hashes, node hashes, and IDs
can never collide.
EOF
```

---

## 2. Writing and Updating Rationales Later

You can add or update a node's rationale at any time with `deccy rationale` (alias `prose` or `r`).

### Pipe from stdin or copy from a file

```sh
# From stdin
printf 'Updated reasoning for this decision.\n' | deccy rationale ktvsvszp --file -

# From a file in the working tree
deccy rationale ktvsvszp --file notes/draft.md
```

### Edit interactively in `$EDITOR`

Run `deccy rationale <id>` with no `--file` or `--path` flags to open the rationale in `$EDITOR`:

```sh
EDITOR=vim deccy rationale ktvsvszp
```

If the editor exits non-zero, `deccy` restores the original file (or deletes the temporary file if none existed) and leaves the record untouched.

### Use a custom filename inside `.deccy/rationale/`

By default, `deccy` stores prose at `rationale/<id>.md`. To store or re-point a node's rationale at a named file inside `.deccy/rationale/`:

```sh
# Write from stdin to a custom path inside .deccy/rationale/
printf 'Schema notes\n' | deccy rationale ktvsvszp --file - --path rationale/schema-notes.txt

# Or re-point to a file that already exists at .deccy/rationale/shared.md
deccy rationale ktvsvszp --path rationale/shared.md
```

### View the record or its rationale

```sh
# Print the JSON record on disk
deccy show ktvsvszp

# Print the raw rationale bytes
deccy show ktvsvszp --rationale
```

---

## 3. Wiring Nodes with Connectors

Connectors link premise/source nodes (`--tail`, `-T`) to conclusion/target nodes (`--head`, `-H`).

### Create a connected connector in one step

```sh
deccy new -c -t ears -T "When a record is written, prose is published first" \
  --tail ktvsvszp \
  --head pouvsykp
```

Multiple `--tail` and `--head` flags can be passed to form an AND-set on either end:

```sh
deccy new -c -t review-criteria -T "CLI envelope satisfies both refusal and canonical specs" \
  -T ktvsvszp -T pouvsykp \
  -H xvzmlntv
```

### Build a skeleton connector and link ends later

You can create a connector before its target decisions exist by omitting `--tail` and `--head`:

```sh
# 1. Create a skeleton connector (tail: [], head: [])
CONN=$(deccy new -c -t review-criteria -T "All verbs return canonical JSON")

# 2. Fill the tail end later
deccy link "$CONN" --tail ktvsvszp --tail pouvsykp

# 3. Fill the head end when ready
deccy link "$CONN" --head xvzmlntv
```

> **Note:** `deccy link` **replaces** whichever end(s) you name on the command line and leaves unnamed ends untouched. To empty an end back to `[]`, pass `--clear tail` or `--clear head`.

---

## 4. Handling Code Edits (Drift) and Decision Updates (Stale Pins)

A typical development cycle follows four steps:

1. **Edit claimed code files.**
2. **Check status:**
   ```sh
   deccy st
   ```
   You will see `drift <path> expected <old8> has <new8>` for each modified file.
3. **Refresh claims on the owning decision(s):**
   ```sh
   # Find the owner of a modified file if needed
   deccy explain src/store.rs

   # Refresh all claims on that node
   deccy claim ktvsvszp --refresh
   ```
   Or add a newly created file to the same decision at the same time:
   ```sh
   deccy claim ktvsvszp src/new_helper.rs --refresh
   ```
4. **Re-pin any connectors that became stale:**
   Refreshing a decision's claims (or editing its title/type with `deccy describe` or prose with `deccy rationale`) changes its node digest. `deccy st` now lists any connectors pinned to that decision under `stale`:
   ```text
   connector qonutznvlyssluxyzysswxltlztxlwro
     tail ktvsvszpzoxlzrsoqpvsuztsstmyvqvp expects 04ef2ce7 has 9c1f2a40
   ```
   Review the connector, then re-pin it:
   ```sh
   deccy link qonutznv --repin
   ```

---

## 5. Transferring or Releasing File Ownership

Because two nodes cannot claim the same file without causing a `collision`, transferring a file fromNode A to Node B is a two-step release-and-claim:

```sh
# 1. Release ownership from Node A (leaves the file on disk untouched)
deccy claim <node-a> --release src/shared.rs

# 2. Claim ownership on Node B
deccy claim <node-b> src/shared.rs
```

---

## 6. Removing a Node Safely

`deccy remove <id>` (alias `deccy rm <id>`) deletes:
1. Every file the node currently claims,
2. The node's rationale file, and
3. The node's record file.

### Case A: You want to delete the node AND its claimed files

First ensure no connector still pins the node. If a connector pins it, `deccy rm` refuses and shows the exact `deccy link` command needed to unhook it:

```sh
# Unhook from connector (either replace the end with remaining IDs or clear the end)
deccy link <connector-id> --clear tail

# Remove the node and its claimed files
deccy rm <node-id>
```

### Case B: You want to delete the node but KEEP its claimed files on disk

Release the claims before running `remove`:

```sh
deccy claim <node-id> --release src/keep_me.rs
deccy rm <node-id>
```

---

## 7. Working with `jj` or `git` and Validating Merges

`deccy` never runs `jj` or `git` write commands. You commit `.deccy/` alongside your code using your normal VCS workflow.

### Recommended `.gitattributes`

Keep node files as LF-terminated text so `git` and `jj` diff and merge them cleanly line-by-line:

```gitattributes
.deccy/nodes/*.json text eol=lf
```

### Checking working-copy changes against `HEAD` / `@`

When a VCS is present, `deccy status` compares `.deccy/nodes/` on disk with the current revision (`@` in `jj`, `HEAD` in `git`) and appends:

```text
vcs jj
revision fcfaa147
added .deccy/nodes/ktvsvszpzoxlzrsoqpvsuztsstmyvqvp.json
changed .deccy/nodes/pouvsykppxynykyovrslllkzyvvkzqmp.json
```

### Validating a merge or revision range

Standard VCS merges can silently lose decision updates if one side of a merge takes its parent's file wholesale or drops a node added on the other parent.

Run `deccy validate --merge` (`-m`) on a merge commit/change to verify how the two parents (`p₁`, `p₂`) combined relative to their merge base (`b`):

```sh
deccy validate --merge
```

Or compare the current revision against any single ancestor revision with `--since <rev>` (`-s <rev>`):

```sh
deccy validate --since main
```

- When clean, `deccy validate --merge` and `deccy validate --since <rev>` produce **no output** in human mode and exit `0`.
- If a side's refinement was discarded (`discards p₁` or `discards p₂`) or a node vanished (`dropped`), `validate` prints the offending node paths and exits `1`.
- If a node was hand-resolved or union-merged such that its bytes differ from both parents and the base, `validate` prints a `merge_authored: merge-authored, review it` warning and still exits `0`.
