Agent workflow
Use this workflow when an agent is updating Archledger-managed architecture records.
Independent preflight
Run these commands independently instead of chaining them with &&, because check may intentionally fail and should not block later diagnostics:
archledger --json pathsarchledger --json statusarchledger --json check
For machine extraction from either success or failure payloads:
archledger --json check | jq '(.result // .error.details) | {errors, warnings}'
Migration branch
If check reports legacy IDs or legacy timestamp metadata:
archledger --json migrate ids --to ledgercore
archledger --json migrate metadata --to versioned
Apply the migrations only after the surrounding change is approved:
archledger --json migrate ids --to ledgercore --apply
archledger --json migrate metadata --to versioned --apply
Re-run archledger --json check before content edits.
Impact and context
For broad refreshes:
archledger --json source changedarchledger --json read --body --include-drafts
Prefer narrower reads when possible:
archledger --json context --changedarchledger --json context --for-file PATHarchledger --json trace RECORD_IDarchledger --json read --section SECTION --bodyarchledger --json read --kind KIND --body
Mutation rules
Edit only source fragments under
.ledger/archledger/data/profiles/arc42/sectionsand.ledger/archledger/data/records.Prefer Archledger mutation commands so record versions stay consistent.
Use
archledger record body set RECORD_ID --from-file /tmp/body.mdfor substantial body updates.For list or object metadata, use
--json-value.For raw strings that begin with option-like prefixes such as
--json, use--string-value.Do not pass semicolon-delimited strings to list-valued fields.
Do not mutate archived records merely to silence live completeness warnings.
Record creation
IDs use one ledger-wide numeric sequence. Do not predict the next ID. Capture the returned result.id from:
archledger --json new KIND "Title"
Final gates
Before finalizing updates:
archledger --json check --strictarchledger --json source changed --fail-on-unlinkedRun project-specific tests that validate the documented boundaries.
Build only when the user needs an exported artifact.
Run
archledger --json source snapshot --reason after-archledger-updateafter updates are validated.
Rules
Treat the fragment tree as the source of truth.
Do not edit generated build output as source.
Add
source_refswhen a fragment describes concrete implementation artifacts.Keep external references generic; Archledger stores links but does not resolve external semantics.