tina-cli 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. {tina_cli-0.1.2 → tina_cli-0.1.4}/.env.example +10 -1
  2. tina_cli-0.1.4/.release-please-manifest.json +3 -0
  3. {tina_cli-0.1.2 → tina_cli-0.1.4}/CHANGELOG.md +7 -0
  4. {tina_cli-0.1.2 → tina_cli-0.1.4}/CONTRIBUTING.md +13 -5
  5. {tina_cli-0.1.2 → tina_cli-0.1.4}/PKG-INFO +15 -7
  6. {tina_cli-0.1.2 → tina_cli-0.1.4}/README.md +14 -6
  7. tina_cli-0.1.4/docs/adr/017-governor-seam.md +42 -0
  8. tina_cli-0.1.4/docs/adr/018-structured-query-inputs.md +41 -0
  9. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/architecture.md +138 -13
  10. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/control.md +17 -0
  11. {tina_cli-0.1.2 → tina_cli-0.1.4}/examples/tina.toml +35 -3
  12. {tina_cli-0.1.2 → tina_cli-0.1.4}/pyproject.toml +1 -1
  13. {tina_cli-0.1.2 → tina_cli-0.1.4}/release-please-config.json +2 -1
  14. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/cli.py +259 -32
  15. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/config.py +264 -23
  16. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/control.py +25 -4
  17. tina_cli-0.1.4/src/tina/doctor.py +158 -0
  18. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/executors/cloudrun.py +8 -6
  19. tina_cli-0.1.4/src/tina/governor.py +49 -0
  20. tina_cli-0.1.4/src/tina/harness.py +357 -0
  21. tina_cli-0.1.4/src/tina/introspect.py +205 -0
  22. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/output.py +10 -0
  23. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/prompt.py +13 -0
  24. tina_cli-0.1.4/src/tina/query.py +80 -0
  25. tina_cli-0.1.4/src/tina/scrub.py +60 -0
  26. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/sources/__init__.py +1 -0
  27. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/sources/base.py +24 -9
  28. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/sources/github.py +12 -2
  29. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/sources/jira.py +57 -15
  30. tina_cli-0.1.4/src/tina/validate.py +340 -0
  31. tina_cli-0.1.4/src/tina/verify.py +165 -0
  32. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/integration/test_cli.py +359 -3
  33. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_config.py +319 -0
  34. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_control.py +18 -0
  35. tina_cli-0.1.4/tests/unit/test_doctor.py +266 -0
  36. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_executors.py +28 -0
  37. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_harness.py +174 -1
  38. tina_cli-0.1.4/tests/unit/test_introspect.py +94 -0
  39. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_prompt.py +24 -0
  40. tina_cli-0.1.4/tests/unit/test_query.py +72 -0
  41. tina_cli-0.1.4/tests/unit/test_scrub.py +46 -0
  42. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_sources_github.py +37 -6
  43. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_sources_jira.py +102 -0
  44. tina_cli-0.1.4/tests/unit/test_validate.py +217 -0
  45. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_verify.py +91 -0
  46. {tina_cli-0.1.2 → tina_cli-0.1.4}/uv.lock +1 -1
  47. tina_cli-0.1.2/.release-please-manifest.json +0 -3
  48. tina_cli-0.1.2/src/tina/harness.py +0 -175
  49. tina_cli-0.1.2/src/tina/verify.py +0 -92
  50. {tina_cli-0.1.2 → tina_cli-0.1.4}/.github/workflows/ci.yml +0 -0
  51. {tina_cli-0.1.2 → tina_cli-0.1.4}/.github/workflows/pr-title.yml +0 -0
  52. {tina_cli-0.1.2 → tina_cli-0.1.4}/.github/workflows/release-please.yml +0 -0
  53. {tina_cli-0.1.2 → tina_cli-0.1.4}/.github/workflows/release.yml +0 -0
  54. {tina_cli-0.1.2 → tina_cli-0.1.4}/.gitignore +0 -0
  55. {tina_cli-0.1.2 → tina_cli-0.1.4}/AGENTS.md +0 -0
  56. {tina_cli-0.1.2 → tina_cli-0.1.4}/CLAUDE.md +0 -0
  57. {tina_cli-0.1.2 → tina_cli-0.1.4}/Dockerfile.reference +0 -0
  58. {tina_cli-0.1.2 → tina_cli-0.1.4}/LICENSE +0 -0
  59. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/README.md +0 -0
  60. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/agent.py +0 -0
  61. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/demo.sh +0 -0
  62. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/overlay.toml +0 -0
  63. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/queue.sh +0 -0
  64. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/record.sh +0 -0
  65. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/stub_server.py +0 -0
  66. {tina_cli-0.1.2 → tina_cli-0.1.4}/demo/workdir.sh +0 -0
  67. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/000-adr-template.md +0 -0
  68. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/001-orchestration-only-factory.md +0 -0
  69. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/002-no-scheduling-ownership.md +0 -0
  70. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/003-dispatch-worker-split.md +0 -0
  71. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/004-worker-side-claiming.md +0 -0
  72. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/005-harness-adapters-declarative-outcome-file.md +0 -0
  73. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/006-four-state-outcome-contract.md +0 -0
  74. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/007-generic-artifact-verification.md +0 -0
  75. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/008-tracks-installed-via-napoln.md +0 -0
  76. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/009-python.md +0 -0
  77. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/010-two-implementations-per-adapter-family.md +0 -0
  78. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/011-control-plane-data-plane-split.md +0 -0
  79. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/012-control-file-is-a-path.md +0 -0
  80. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/013-lifecycle-write-back-is-not-result-writing.md +0 -0
  81. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/014-claim-policy-per-track.md +0 -0
  82. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/015-sweep-tracks-run-without-a-work-item.md +0 -0
  83. {tina_cli-0.1.2 → tina_cli-0.1.4}/docs/adr/016-dispatch-budgets-by-live-executor-state.md +0 -0
  84. {tina_cli-0.1.2 → tina_cli-0.1.4}/examples/README.md +0 -0
  85. {tina_cli-0.1.2 → tina_cli-0.1.4}/examples/bug-triage/README.md +0 -0
  86. {tina_cli-0.1.2 → tina_cli-0.1.4}/examples/bug-triage/tina.toml +0 -0
  87. {tina_cli-0.1.2 → tina_cli-0.1.4}/examples/bug-triage/tracks/triage/SKILL.md +0 -0
  88. {tina_cli-0.1.2 → tina_cli-0.1.4}/justfile +0 -0
  89. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/__init__.py +0 -0
  90. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/__main__.py +0 -0
  91. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/errors.py +0 -0
  92. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/executors/__init__.py +0 -0
  93. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/executors/base.py +0 -0
  94. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/executors/local.py +0 -0
  95. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/log.py +0 -0
  96. {tina_cli-0.1.2 → tina_cli-0.1.4}/src/tina/models.py +0 -0
  97. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/conftest.py +0 -0
  98. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_errors.py +0 -0
  99. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_output.py +0 -0
  100. {tina_cli-0.1.2 → tina_cli-0.1.4}/tests/unit/test_version.py +0 -0
  101. {tina_cli-0.1.2 → tina_cli-0.1.4}/tina-demo.gif +0 -0
@@ -6,10 +6,12 @@ JIRA_BASE_URL=https://your-org.atlassian.net
6
6
  JIRA_EMAIL=bot@your-org.example
7
7
  JIRA_API_TOKEN=
8
8
  # Atlassian account id of the bot user. Claiming assigns the issue to it.
9
+ # Optional — looked up via GET /rest/api/3/myself when unset.
9
10
  JIRA_BOT_ACCOUNT_ID=
10
11
 
11
12
  # --- GitHub Issues source (source = "github") ----------------------------
12
- # Needs repo scope: read issues, assign issues.
13
+ # Needs repo scope: read issues, assign issues. GH_TOKEN (the GitHub CLI's
14
+ # spelling) is accepted when GITHUB_TOKEN is unset.
13
15
  GITHUB_TOKEN=
14
16
  # Login of the bot user. Optional — looked up via GET /user when unset.
15
17
  GITHUB_BOT_LOGIN=
@@ -22,6 +24,13 @@ GITHUB_BOT_LOGIN=
22
24
  # TINA_CONTROL.
23
25
  #TINA_CONTROL_INLINE=
24
26
 
27
+ # --- Paths ---------------------------------------------------------------
28
+ # Override the config location and the config's paths, so one image runs
29
+ # against a config mounted anywhere. Each is optional.
30
+ #TINA_CONFIG=/mnt/config/tina.toml
31
+ #TINA_TRACKS_DIR=/app/tracks
32
+ #TINA_ARTIFACTS_DIR=/mnt/artifacts
33
+
25
34
  # --- Harness -------------------------------------------------------------
26
35
  # Seconds before Tina kills the agent subprocess. Default 3600.
27
36
  TINA_HARNESS_TIMEOUT=3600
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.4"
3
+ }
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.4](https://github.com/raiderrobert/tina/compare/v0.1.2...v0.1.4) (2026-09-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * close the remaining gaps to a production factory ([#32](https://github.com/raiderrobert/tina/issues/32) P2–P5) ([#62](https://github.com/raiderrobert/tina/issues/62)) ([5a3ee4a](https://github.com/raiderrobert/tina/commit/5a3ee4aa661ef43aff930d202c940bb1173fcaa2))
9
+
3
10
  ## [0.1.2](https://github.com/raiderrobert/tina/compare/v0.1.1...v0.1.2) (2026-08-27)
4
11
 
5
12
 
@@ -53,15 +53,22 @@ caches). `just` with no recipe lists them all.
53
53
 
54
54
  ```
55
55
  src/tina/
56
- ├── cli.py # `tina dispatch` and `tina run` — two roles, one image
56
+ ├── cli.py # dispatch, run, status, tracks, config-options, validate, doctor
57
57
  ├── __main__.py # `python -m tina`, how the local executor spawns workers
58
58
  ├── config.py # TOML configuration
59
+ ├── query.py # Structured query inputs -> JQL / GitHub search
59
60
  ├── control.py # Runtime policy: paused and max_concurrency, fail-closed
61
+ ├── governor.py # The Governor protocol: a per-cycle throughput policy seam
60
62
  ├── models.py # Work items in, outcome reports out
61
63
  ├── prompt.py # One-shot prompt assembly
62
- ├── harness.py # Harness invocation
64
+ ├── harness.py # Harness invocation, retry rules, artifact capture
65
+ ├── scrub.py # Credential redaction for captured artifacts
63
66
  ├── verify.py # Generic artifact verification
67
+ ├── validate.py # Admission: static checks on config and skills
68
+ ├── doctor.py # Admission: live probes of credentials, queries, harness
69
+ ├── introspect.py # `tina tracks` and `tina config-options` renderers
64
70
  ├── log.py # Structured logging, one JSON object per line
71
+ ├── output.py # Human-facing stderr output
65
72
  ├── errors.py # TinaError — the one thing the CLI catches
66
73
  ├── sources/ # Where work items come from, and how they get claimed
67
74
  │ ├── base.py # Source protocol, require_env, parse_payload
@@ -85,8 +92,9 @@ justfile # Every check, in one place
85
92
  ## Adding a source adapter
86
93
 
87
94
  1. Implement the `Source` protocol in `src/tina/sources/base.py` — `query`,
88
- `get`, `claim`. Use `require_env` and `parse_payload` from the same module
89
- for credentials and response validation.
95
+ `get`, `matches`, `claim`, `claim_prognosis`, `claimed`, `annotate`,
96
+ `block`, `login`. Use `require_env` and `parse_payload` from the same
97
+ module for credentials and response validation.
90
98
  2. Register it in the `build()` dispatch in `src/tina/sources/__init__.py`.
91
99
  3. Add `tests/unit/test_sources_<name>.py`, modeled on `test_sources_jira.py` and
92
100
  `test_sources_github.py`.
@@ -96,7 +104,7 @@ justfile # Every check, in one place
96
104
  ## Adding an executor
97
105
 
98
106
  1. Implement the `Executor` protocol in `src/tina/executors/base.py` —
99
- `enqueue`.
107
+ `enqueue`, `running`, `run_url`.
100
108
  2. Register it in `build()` in `src/tina/executors/__init__.py`.
101
109
  3. Add cases to `tests/unit/test_executors.py`, modeled on the existing `local` and
102
110
  `cloudrun` tests.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tina-cli
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: An autonomous factory. Orchestration only: claim a work item, run an agent once, record the outcome.
5
5
  Project-URL: Homepage, https://github.com/raiderrobert/tina
6
6
  License-Expression: MIT
@@ -55,16 +55,16 @@ This approach scales your attention better than having 5 simultaneous agent sess
55
55
  A track is `Source -> Skill -> Result`.
56
56
 
57
57
  ```toml
58
- harness = "pi"
58
+ harness = "pi"
59
59
  executor = "local"
60
60
 
61
61
  [harnesses.pi]
62
- command = ["pi", "--prompt-file", "{prompt_file}"]
62
+ command = ["pi", "-p", "@{prompt_file}"]
63
63
 
64
64
  [bug]
65
65
  source = "github"
66
66
  repo = "acme/api"
67
- query = "repo:acme/api is:issue is:open no:assignee label:bug"
67
+ labels = ["bug"] # or the full query = "repo:acme/api is:issue ..."
68
68
  track = "triage"
69
69
  result = "github:issue-comment"
70
70
  ```
@@ -72,9 +72,11 @@ result = "github:issue-comment"
72
72
  A basic workflow:
73
73
 
74
74
  ```bash
75
- tina dispatch --track bug --limit 5
76
- tina run --track bug --item 4821
77
- tina status --track bug
75
+ tina validate # the config and every skill, statically
76
+ tina doctor # credentials, queries, harness, executor
77
+ tina dispatch --track bug --limit 5
78
+ tina run --track bug --item 4821
79
+ tina status --track bug
78
80
  ```
79
81
 
80
82
  `status` derives both counts from the track's own `query` — once as `dispatch` runs
@@ -94,8 +96,14 @@ without Tina knowing about them.
94
96
  provides.
95
97
  - **No persistent state.** The tracker is the ledger. Workers claim items, and
96
98
  claimed items drop out of the query.
99
+ - **Control plane in a file.** Pause and throttle live in a control file
100
+ read fresh every dispatch, so whoever holds the pager can stop the factory
101
+ without a deploy. Per-track `max_concurrency` and a governor seam sit
102
+ beside it.
97
103
  - **No tracks included.** Tracks are skills, installed with
98
104
  [napoln](https://github.com/raiderrobert/napoln) at image build time.
105
+ `tina tracks --format json` lists them so infrastructure can be derived
106
+ from the same file the runtime reads.
99
107
 
100
108
  ## Documentation
101
109
 
@@ -40,16 +40,16 @@ This approach scales your attention better than having 5 simultaneous agent sess
40
40
  A track is `Source -> Skill -> Result`.
41
41
 
42
42
  ```toml
43
- harness = "pi"
43
+ harness = "pi"
44
44
  executor = "local"
45
45
 
46
46
  [harnesses.pi]
47
- command = ["pi", "--prompt-file", "{prompt_file}"]
47
+ command = ["pi", "-p", "@{prompt_file}"]
48
48
 
49
49
  [bug]
50
50
  source = "github"
51
51
  repo = "acme/api"
52
- query = "repo:acme/api is:issue is:open no:assignee label:bug"
52
+ labels = ["bug"] # or the full query = "repo:acme/api is:issue ..."
53
53
  track = "triage"
54
54
  result = "github:issue-comment"
55
55
  ```
@@ -57,9 +57,11 @@ result = "github:issue-comment"
57
57
  A basic workflow:
58
58
 
59
59
  ```bash
60
- tina dispatch --track bug --limit 5
61
- tina run --track bug --item 4821
62
- tina status --track bug
60
+ tina validate # the config and every skill, statically
61
+ tina doctor # credentials, queries, harness, executor
62
+ tina dispatch --track bug --limit 5
63
+ tina run --track bug --item 4821
64
+ tina status --track bug
63
65
  ```
64
66
 
65
67
  `status` derives both counts from the track's own `query` — once as `dispatch` runs
@@ -79,8 +81,14 @@ without Tina knowing about them.
79
81
  provides.
80
82
  - **No persistent state.** The tracker is the ledger. Workers claim items, and
81
83
  claimed items drop out of the query.
84
+ - **Control plane in a file.** Pause and throttle live in a control file
85
+ read fresh every dispatch, so whoever holds the pager can stop the factory
86
+ without a deploy. Per-track `max_concurrency` and a governor seam sit
87
+ beside it.
82
88
  - **No tracks included.** Tracks are skills, installed with
83
89
  [napoln](https://github.com/raiderrobert/napoln) at image build time.
90
+ `tina tracks --format json` lists them so infrastructure can be derived
91
+ from the same file the runtime reads.
84
92
 
85
93
  ## Documentation
86
94
 
@@ -0,0 +1,42 @@
1
+ # 17. A governor seam, and no governor
2
+
3
+ **Status:** Proposed
4
+
5
+ **Date:** 2026-09-03
6
+
7
+ ## Context
8
+
9
+ A factory that has run unattended for a while grows an adaptive throughput
10
+ policy: halve the cap on a failure burst, climb it back on healthy deep-backlog
11
+ cycles, remember the level that last hurt. The signals it reads — worker
12
+ failure rates from the executor's metrics, spend, time of day — are things Tina
13
+ deliberately does not model, and the policy itself is opinion that a
14
+ deployment tunes for months. Building one into Tina would either fix that
15
+ opinion or grow a policy language. Leaving it out entirely forces a deployment
16
+ to fork `dispatch_track` to plug its own in, and the fork drifts.
17
+
18
+ ## Decision
19
+
20
+ `dispatch_track` accepts an optional `Governor`: a protocol with two methods.
21
+ `cap(track, ceiling, in_flight)` is asked once per cycle, after the control
22
+ file and the in-flight count are known and before any work is picked, and may
23
+ return a lower cap. `record(track, ceiling=, cap=, in_flight=, budget=,
24
+ matched=, launched=)` is told what the cycle did, once, after the last
25
+ enqueue. Tina ships no governor. The human ceiling always dominates: a cap
26
+ above it is clamped, and a governor that raises is logged and treated as
27
+ absent for the cycle, so a broken feedback loop degrades to the static cap.
28
+
29
+ ## Consequences
30
+
31
+ - Adaptive throughput is a deployment concern with a stable seam, not a fork.
32
+ A governor lives beside the factory's other infrastructure-specific code —
33
+ its metrics client, its state bucket — and Tina never learns what those are.
34
+ - The seam is consistent with I1 and I2 of
35
+ [ADR-011](011-control-plane-data-plane-split.md): a governor is consulted at
36
+ dispatch and nowhere else, and it can only lower the gate a human set.
37
+ - The dispatch record carries the ceiling and the cap separately and names
38
+ `governor` as the origin when it bound, so a cycle throttled by the governor
39
+ is distinguishable from one throttled by a human in the log alone.
40
+ - Two calls per cycle are the whole surface. A governor wanting more — the
41
+ matched items themselves, say — would be reading work-item content at the
42
+ control plane, which I3 forbids.
@@ -0,0 +1,41 @@
1
+ # 18. Structured query inputs build the query; `query` remains the override
2
+
3
+ **Status:** Proposed
4
+
5
+ **Date:** 2026-09-03
6
+
7
+ ## Context
8
+
9
+ Every track needed a hand-written full query. In practice most tracks are one
10
+ query shape where a list changes — a Jira project plus the set of opted-in
11
+ teams, a GitHub repo plus a label set — and the invariants that must not be
12
+ forgotten (queued status, unassigned, not blocked, not claimed, stable sort)
13
+ were re-typed into every string. Onboarding a team meant editing a JQL
14
+ expression in a PR that only its author could review. And a value spliced
15
+ into a query by hand is not validated: a team name with a quote in it is at
16
+ best a broken query.
17
+
18
+ ## Decision
19
+
20
+ A track may give the parts of its query instead of the query. Jira takes
21
+ `project`, `status`, `filters` (a table of field name to allowed values, each
22
+ a `"Field" in (...)` clause), and `extra`; GitHub takes `repo` and `labels`.
23
+ `tina.query` builds the query from them, owning the universal predicates and
24
+ excluding the track's blocked and claim markers itself, and under a claim
25
+ transition offering back bot-held items still in the queued status. Every
26
+ interpolated value is validated at load — project key, field name, value
27
+ charset, repo shape, no quotes in labels — so the builders concatenate
28
+ without escaping. `query` stays the full override for anything that does not
29
+ fit; a track may not set both, and the error names the structured keys it
30
+ would have to drop.
31
+
32
+ ## Consequences
33
+
34
+ - Onboarding is one array edit, reviewable by someone who is not the author.
35
+ - The universal predicates live in one place. A track that needs to relax
36
+ them writes `query` and takes on the whole string, explicitly.
37
+ - Structured inputs are per source and the sets are disjoint; a Jira key on
38
+ a GitHub track is a load-time error, not an ignored key.
39
+ - The builders are pure string functions imported by the config module, so
40
+ the effective query is on the parsed track (`track.query`) — `tina
41
+ validate`'s summary, `status`, and `dispatch` all read the same string.
@@ -24,17 +24,49 @@ Code, Gemini CLI, and others are supported through the same adapter contract.
24
24
 
25
25
  ## 3. Entrypoints
26
26
 
27
- Tina is a library with a CLI in front of it. Two subcommands:
27
+ Tina is a library with a CLI in front of it. Two data-plane subcommands:
28
28
 
29
29
  ```
30
- tina dispatch --track vul --limit 5 # what the scheduler calls
30
+ tina dispatch --track vul # what the scheduler calls
31
31
  tina run --track vul --item VUL-123 # what the executor spawns; also local dev
32
32
  ```
33
33
 
34
- Both subcommands split their output by audience: stdout carries the structured
34
+ and four control-plane ones ([ADR-011](adr/011-control-plane-data-plane-split.md)):
35
+
36
+ ```
37
+ tina status --track vul # introspection: queued and in flight
38
+ tina tracks [--format json] # introspection: what is configured
39
+ tina config-options [--format markdown] # introspection: every track key, from the schema
40
+ tina validate # admission: config and every skill, statically
41
+ tina doctor # admission: credentials, queries, harness, models, executor
42
+ ```
43
+
44
+ Every subcommand splits its output by audience: stdout carries the structured
35
45
  JSON log — one object per line, including the error record when a run fails —
36
46
  and stderr carries the human-readable `✗ message / Cause: / Fix:` block, so a
37
- collector parsing stdout never has prose to skip.
47
+ collector parsing stdout never has prose to skip. `tracks` and
48
+ `config-options` are the exception: their whole output is data, on stdout, so
49
+ infrastructure and docs can be derived from it.
50
+
51
+ `--config` defaults to `$TINA_CONFIG`, then `tina.toml` in the working
52
+ directory. `TINA_TRACKS_DIR` and `TINA_ARTIFACTS_DIR` override the config's
53
+ paths the same way `TINA_CONTROL` does, so one image runs against a config
54
+ mounted anywhere. `run --model` runs one execution on a model other than the
55
+ track's own, for trying one out without editing the config.
56
+
57
+ ### Embedding
58
+
59
+ Tina is a library first. A factory with its own operator CLI calls
60
+ `config.load(path, tracks_dir=…, control=…, artifacts_dir=…)`,
61
+ `cli.run_item`, `cli.dispatch_track` (with a `Governor`, §5), `validate`,
62
+ `doctor.diagnose`, and `introspect` directly, and keeps its own names for
63
+ everything a person sees: its registry can be `config/tracks.toml`, its
64
+ environment variables its own, its commands under its own binary. The
65
+ `TINA_*` variables and the `tina.toml` default are conveniences of the `tina`
66
+ command, not the contract; the `$WORK_ITEM_KEY` token and the outcome
67
+ instructions in the prompt are the contract, because tracks are written
68
+ against them. Text Tina writes where a person will read it — the write-back
69
+ comment on a work item — names no runner for the same reason.
38
70
 
39
71
  Tina does not own scheduling. There is no open standard for declaring a schedule
40
72
  that targets native cloud schedulers, and cron dialects are not even portable
@@ -76,6 +108,35 @@ One track can produce different results per run: the vulnerability track
76
108
  ends in a PR link or a discovery comment depending on what it finds. Results are
77
109
  not 1:1 with tracks.
78
110
 
111
+ ### Structured query inputs
112
+
113
+ Most tracks are one query shape where a list changes: a project plus the set
114
+ of opted-in teams, a repo plus a label set. A track may give the parts instead
115
+ of the query, and Tina builds it (`tina.query`):
116
+
117
+ ```toml
118
+ [vul]
119
+ source = "jira"
120
+ project = "VUL"
121
+ extra = "labels not in (wontfix)"
122
+ [vul.filters]
123
+ Team = ["Payments", "Search"] # onboarding a team is one line
124
+
125
+ [smoke]
126
+ source = "github"
127
+ repo = "acme/api"
128
+ labels = ["needs-triage"]
129
+ ```
130
+
131
+ The builder owns the invariants every track would otherwise re-type into every
132
+ query string: the queued status, unassigned, not blocked, not claimed, oldest
133
+ first. Under `claim = "assign"` with a `claim_transition`, bot-held items still
134
+ in the queued status are offered back — the transition, not the assignee, is
135
+ what excludes an item, so one still queued was reopened upstream. Every value
136
+ interpolated is validated at load (charset, shape): a team name with a quote
137
+ in it is at best a broken query. `query` remains the full override for
138
+ anything that does not fit; a track may not set both.
139
+
79
140
  ### Sweep tracks
80
141
 
81
142
  Not every useful track has a queue: scan recent job executions and file an
@@ -103,8 +164,8 @@ Two roles, one image.
103
164
  jobs through an executor. It never runs an agent.
104
165
 
105
166
  N is a budget over live workers, not launches per call:
106
- `max(0, min(--limit, max_concurrency) − in flight)`, where in flight is what
107
- the executor's `running()` reports for the track
167
+ `max(0, ceiling − in flight)`, where in flight is what the executor's
168
+ `running()` reports for the track
108
169
  ([ADR-016](adr/016-dispatch-budgets-by-live-executor-state.md)). Without the
109
170
  subtraction, a 15-minute scheduler launching the full limit against hour-long
110
171
  runs multiplies the knob by four to twelve. Items already in flight are
@@ -115,6 +176,23 @@ dispatch while its one worker is still out. A dry run builds no executor, so
115
176
  it assumes zero in flight and says so when that is an assumption rather than
116
177
  a fact.
117
178
 
179
+ The ceiling comes from three knobs, each at a different tier. The track's own
180
+ `max_concurrency` is declaration: a track that sets one has opted out of the
181
+ fleet knob, and only `paused` still stops it. Otherwise the control file's
182
+ `max_concurrency` applies — policy, changed without a deploy. `--limit` on
183
+ the command line can only lower whichever of those applies. With none of the
184
+ three set, the ceiling is 1. The dispatch record names which knob won, so a
185
+ cycle that launched fewer workers than expected is explainable from the log.
186
+
187
+ A deployment may also hand `dispatch_track` a **governor**
188
+ ([ADR-017](adr/017-governor-seam.md)): an object asked once per cycle for a
189
+ lower cap, and told afterwards what the cycle did — the ceiling, the cap that
190
+ applied, workers in flight, the budget, items matched, launches made. That is
191
+ the seam for adaptive throughput — halve on a failure burst, climb on healthy
192
+ deep-backlog cycles — reading signals Tina does not model. Tina ships no
193
+ governor; it can only lower the ceiling, and one that raises is treated as
194
+ absent for the cycle.
195
+
118
196
  **Worker** takes a single work item identifier, claims it, runs the agent once,
119
197
  and records the outcome. One item = one run = one container = one log stream.
120
198
 
@@ -240,8 +318,17 @@ query. All judgment about what the item actually is happens inside the track.
240
318
  | `claimed(q)` | `status` | the same query with its unclaimed clause inverted: what workers hold now |
241
319
  | `matches(item_id, q)` | worker | re-check the whole query against one item at worker start |
242
320
  | `claim(item)` | worker | mark the item as taken; fail if already claimed |
321
+ | `annotate(item, comment)`, `block(item)` | worker | lifecycle write-back after a bad run (§15) |
322
+ | `login()` | `doctor` | one authenticated read — who the credentials act as — and nothing else |
243
323
  | `normalize(payload)` | deferred | turn an inbound webhook payload into a work item |
244
324
 
325
+ Credentials come from the environment: `JIRA_BASE_URL`, `JIRA_EMAIL`,
326
+ `JIRA_API_TOKEN`; `GITHUB_TOKEN`, or `GH_TOKEN` — the GitHub CLI's spelling —
327
+ when that is what the image already carries. The bot's own identity is
328
+ configured (`JIRA_BOT_ACCOUNT_ID`, `GITHUB_BOT_LOGIN`) or looked up once from
329
+ the credentials (`/myself`, `/user`), so a deployment that rotates the bot
330
+ account changes one secret and nothing else.
331
+
245
332
  `matches` is the eligibility re-check: between dispatch and worker start an
246
333
  item can be assigned, closed, labeled, or worked by a human, and only the
247
334
  claim would notice — and only the assignee case. The worker re-checks the
@@ -264,6 +351,10 @@ ladder, and a 429 once, honoring a numeric `Retry-After` up to the minute the
264
351
  ladder allows. No other 4xx is ever retried, and a failure that outlives its
265
352
  ladder raises with the original status and message.
266
353
 
354
+ GitHub work items are identified as `owner/name#N` — an issue's identity is
355
+ its repo and its number, and the qualified form is unambiguous in a run
356
+ record or a log line. Every entry point also accepts the bare number.
357
+
267
358
  v1 ships **Jira** and **GitHub Issues**. Two adapters, not one — a single
268
359
  implementation makes the interface accidentally Jira-shaped, and an OSS project
269
360
  that cannot be tried without a Jira instance will not get used. GitHub Issues is
@@ -359,7 +450,7 @@ config rather than a code plugin:
359
450
  harness = "pi" # which one to use
360
451
 
361
452
  [harnesses.pi]
362
- command = ["pi", "--prompt-file", "{prompt_file}"]
453
+ command = ["pi", "-p", "@{prompt_file}"]
363
454
 
364
455
  [harnesses.claude]
365
456
  command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
@@ -376,12 +467,37 @@ tracks — and a track setting `model` under a command that never references it
376
467
  is equally a config-load error, because the value would silently not reach the
377
468
  harness.
378
469
 
470
+ A top-level `models` list names the models the deployment has enabled, as
471
+ the exact strings `{model}` takes. Tina never parses a model reference — its
472
+ grammar is the harness's — so the list is matched literally. When set, every
473
+ track's `model` and every `run --model` override must be in it, checked at
474
+ config load: a model the provider does not serve this deployment fails every
475
+ run of the track that names it, from inside the harness where nobody is
476
+ looking. The same list is what `doctor` proves answers (§3): one trivial
477
+ prompt through the real command per model, with a harness retry marker in the
478
+ output counting as an answer — the request reached the model. Unset means
479
+ unconstrained.
480
+
379
481
  The assembled prompt opens by naming the absolute skill directory. Skills past
380
482
  a few hundred lines are multi-file (`paths/`, `references/`, `scripts/`), the
381
483
  agent runs with its working directory set to the run's temp workdir, and
382
484
  without the anchor every relative reference in the skill resolves nowhere.
383
485
  `SKILL.md`'s leading YAML frontmatter is stripped before inlining — it is
384
- adapter metadata, not prompt content.
486
+ adapter metadata, not prompt content. One token is substituted in the skill
487
+ body: `$WORK_ITEM_KEY` becomes the item's tracker identifier, so a router can
488
+ open with "Work item: $WORK_ITEM_KEY" without parsing the JSON block that
489
+ follows. It is the only runner token; `tina validate` rejects any other bare
490
+ `$TOKEN` in prose.
491
+
492
+ A harness table may carry `retry` rules: output markers that mean the
493
+ failure clears on its own — a model provider shedding load, a per-minute
494
+ quota — and a ladder of waits, one retry per entry. Rules are tried in
495
+ configured order, most specific first, and the first that matches decides the
496
+ schedule; once its ladder is spent the failure stands. With rules set, the
497
+ harness's output is relayed line by line so the markers can be seen — to
498
+ stderr, since stdout is Tina's JSON records. Without rules the output is
499
+ inherited and the harness runs exactly once. Tina still never *parses* that
500
+ output for an outcome: a marker is a reason to run again, not a report.
385
501
 
386
502
  `{session_dir}` is where the harness leaves its session — the transcript, tool
387
503
  calls, and token costs the final message never shows. A command referencing it
@@ -394,7 +510,11 @@ is best-effort — a capture failure is logged and never fails the run — and t
394
510
  destination is just a path, so a bucket mount works with no cloud code in
395
511
  Tina, the same reasoning as the control file. `artifacts_dir` unset skips the
396
512
  copy silently; `{session_dir}` still substitutes, so one harness table works
397
- in both environments.
513
+ in both environments. Text files are scrubbed of credential material on the
514
+ way (`tina.scrub`): a transcript records tool output verbatim, and an agent
515
+ that prints its environment lands every token it holds in one. Redaction is by
516
+ shape — GitHub and Atlassian tokens, JWTs, Basic auth, PEM keys — so the
517
+ scrubber holds no secrets of its own.
398
518
 
399
519
  **Tina does not parse harness stdout.** Each harness reports differently, and
400
520
  parsing per-harness output is where swappability rots. Instead Tina passes an
@@ -456,20 +576,22 @@ secrets plumbing.
456
576
  harness = "pi" # selects [harnesses.pi]
457
577
  executor = "cloudrun" # selects [executors.cloudrun]
458
578
  tracks_dir = "tracks" # where napoln installed the skills
579
+ models = ["claude-sonnet-x", "gemini-flash-y"] # what {model} may be; unset = anything
459
580
 
460
581
  [harnesses.pi]
461
- command = ["pi", "--prompt-file", "{prompt_file}"]
582
+ command = ["pi", "-p", "@{prompt_file}"]
462
583
 
463
584
  [executors.cloudrun]
464
585
  project = "acme-prod"
465
586
  region = "us-central1"
466
- job = "tina-worker"
587
+ job = "tina-{track}" # {track} optional: one job per track, sized per track
467
588
 
468
589
  [vul]
469
590
  source = "jira"
470
591
  query = "project = VUL AND status = Open AND assignee IS EMPTY"
471
592
  track = "remediate" # skill under tracks_dir; defaults to the key
472
593
  result = "github:pr" # declaration only
594
+ max_concurrency = 4 # this track's cap on live workers; opts out of the fleet knob
473
595
 
474
596
  [bug]
475
597
  source = "github"
@@ -523,8 +645,11 @@ activity in the logs. Per track, `on_failure` decides:
523
645
  - `"leave"` (default) — the item is untouched and retried next cycle.
524
646
  - `"annotate"` — the worker comments the effective status, the agent's
525
647
  details, and the executor's log link on the item, then applies the source's
526
- exclusion marker — a label, `tina-blocked` unless the track sets
527
- `blocked_label` — so the configured query stops matching it.
648
+ exclusion marker so the configured query stops matching it. The marker is a
649
+ label, `tina-blocked` unless the track sets `blocked_label`; a Jira track may
650
+ instead set `blocked_transition`, and the item moves to that status — the
651
+ query's own `status =` clause excludes it, and humans find the item in the
652
+ workflow state they already watch.
528
653
 
529
654
  It triggers on *effective* status: `failed`, `needs_human`, and `resolved`
530
655
  that failed verification. Clean outcomes write nothing. The track query has to
@@ -22,6 +22,23 @@ Tina finds the file in this order
22
22
  3. `control = "/mnt/config/control.toml"` — a top-level key in `tina.toml`.
23
23
  4. Nothing configured — defaults: not paused, no throttle.
24
24
 
25
+ ## Room for the deployment's own gates
26
+
27
+ Tina's keys are strict: an unknown top-level key is a typo and pauses. A
28
+ *table* Tina does not define passes through instead, so a deployment's own
29
+ policy — a governor's mode, say — lives beside `paused` without Tina knowing
30
+ it:
31
+
32
+ ```toml
33
+ paused = false
34
+ max_concurrency = 5
35
+
36
+ [factory]
37
+ governor = "active" # read by the deployment's own dispatch code
38
+ ```
39
+
40
+ Such tables arrive on `LoadedPolicy.extra`, verbatim.
41
+
25
42
  ## Read every dispatch, no cache
26
43
 
27
44
  The file is a kill switch. Staleness is the failure mode, so Tina never caches
@@ -8,6 +8,11 @@ harness = "pi"
8
8
  executor = "local"
9
9
  tracks_dir = "tracks"
10
10
 
11
+ # The models the harness may run, as the exact strings {model} takes. When
12
+ # set, every track's `model` and every `run --model` override must be listed,
13
+ # and `tina doctor` proves each one answers. Unset means unconstrained.
14
+ # models = ["claude-sonnet-x", "gemini-flash-y"]
15
+
11
16
  # Where to keep each run's harness session (transcript, tool calls, costs).
12
17
  # After the harness exits, whatever it left in {session_dir} is copied to
13
18
  # <artifacts_dir>/<item>/ — best-effort, any outcome. Unset skips the copy;
@@ -20,13 +25,20 @@ tracks_dir = "tracks"
20
25
  # control = "/mnt/config/control.toml"
21
26
 
22
27
  [harnesses.pi]
23
- command = ["pi", "--prompt-file", "{prompt_file}"]
28
+ command = ["pi", "-p", "@{prompt_file}"]
24
29
  # A command may also reference {model}; every track must then set `model`,
25
30
  # so each track picks the model its work deserves:
26
- # command = ["pi", "--prompt-file", "{prompt_file}", "--model", "{model}"]
31
+ # command = ["pi", "-p", "@{prompt_file}", "--model", "{model}"]
27
32
  # And {session_dir}: a fresh directory per run where the harness writes its
28
33
  # session, captured to artifacts_dir when that is set:
29
- # command = ["pi", "--prompt-file", "{prompt_file}", "--session-dir", "{session_dir}"]
34
+ # command = ["pi", "-p", "@{prompt_file}", "--session-dir", "{session_dir}"]
35
+ # Output markers that mean "the failure clears on its own — run it again",
36
+ # each with a ladder of waits (one retry per entry). Most specific first: the
37
+ # first rule that matches decides the schedule.
38
+ # retry = [
39
+ # { markers = ["Quota exceeded"], waits = [60, 300, 600], reason = "provider quota" },
40
+ # { markers = ["overloaded_error", "RESOURCE_EXHAUSTED"], waits = [30, 120], reason = "capacity" },
41
+ # ]
30
42
 
31
43
  [harnesses.claude]
32
44
  command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
@@ -35,6 +47,8 @@ command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
35
47
  project = "acme-prod"
36
48
  region = "us-central1"
37
49
  job = "tina-worker"
50
+ # Or one job per track, so each gets its own machine size and timeout:
51
+ # job = "tina-{track}"
38
52
 
39
53
  # Every other table is a track: source -> skill -> result.
40
54
 
@@ -43,6 +57,8 @@ source = "jira"
43
57
  query = "project = VUL AND status = Open AND assignee IS EMPTY"
44
58
  track = "remediate" # skill name under tracks_dir; defaults to the key
45
59
  result = "github:pr" # declaration only — the agent produces it
60
+ # max_concurrency = 4 # this track's cap on live workers. Opts out of the
61
+ # # control file's max_concurrency; paused still applies.
46
62
  # model = "claude-sonnet-x" # substituted for {model} in the harness command;
47
63
  # # required exactly when the command references it
48
64
  # claim = "assign" # how the worker claims (ADR-014): "assign" the
@@ -62,6 +78,20 @@ result = "github:pr" # declaration only — the agent produces it
62
78
  # The query must exclude it, or blocked items match again. Jira:
63
79
  # AND (labels IS EMPTY OR labels != "tina-blocked")
64
80
  # GitHub: -label:tina-blocked
81
+ # blocked_transition = "Blocked" # jira only: block() transitions to this
82
+ # # status instead; the query's status clause
83
+ # # already excludes it.
84
+
85
+ # Instead of `query`, a track may give the parts and let tina build it —
86
+ # the queued status, unassigned, not blocked, not claimed, oldest first are
87
+ # then tina's job, and onboarding a team is one array edit:
88
+ # [vul-by-team]
89
+ # source = "jira"
90
+ # project = "VUL"
91
+ # status = "Open" # the default
92
+ # extra = "labels not in (wontfix)"
93
+ # [vul-by-team.filters]
94
+ # Team = ["Payments", "Search"]
65
95
 
66
96
  [bug]
67
97
  source = "github"
@@ -69,6 +99,8 @@ repo = "acme/api"
69
99
  query = "repo:acme/api is:issue is:open no:assignee label:bug"
70
100
  track = "triage"
71
101
  result = "github:issue-comment"
102
+ # The structured form of the same track:
103
+ # labels = ["bug"] # instead of query; repo is required either way
72
104
 
73
105
  # Optional: literal strings merged over the inherited environment for the
74
106
  # harness subprocess only — how a track skill's scripts get configured.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tina-cli"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "An autonomous factory. Orchestration only: claim a work item, run an agent once, record the outcome."
5
5
  readme = "README.md"
6
6
  license = "MIT"