tina-cli 0.1.2__tar.gz → 0.1.3__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 (100) hide show
  1. {tina_cli-0.1.2 → tina_cli-0.1.3}/.env.example +10 -1
  2. tina_cli-0.1.3/.release-please-manifest.json +3 -0
  3. {tina_cli-0.1.2 → tina_cli-0.1.3}/CHANGELOG.md +20 -0
  4. {tina_cli-0.1.2 → tina_cli-0.1.3}/CONTRIBUTING.md +13 -5
  5. {tina_cli-0.1.2 → tina_cli-0.1.3}/PKG-INFO +15 -7
  6. {tina_cli-0.1.2 → tina_cli-0.1.3}/README.md +14 -6
  7. tina_cli-0.1.3/docs/adr/017-governor-seam.md +42 -0
  8. tina_cli-0.1.3/docs/adr/018-structured-query-inputs.md +41 -0
  9. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/architecture.md +112 -13
  10. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/control.md +17 -0
  11. {tina_cli-0.1.2 → tina_cli-0.1.3}/examples/tina.toml +30 -3
  12. {tina_cli-0.1.2 → tina_cli-0.1.3}/pyproject.toml +1 -1
  13. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/cli.py +235 -30
  14. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/config.py +191 -12
  15. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/control.py +25 -4
  16. tina_cli-0.1.3/src/tina/doctor.py +121 -0
  17. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/executors/cloudrun.py +8 -6
  18. tina_cli-0.1.3/src/tina/governor.py +49 -0
  19. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/harness.py +121 -9
  20. tina_cli-0.1.3/src/tina/introspect.py +203 -0
  21. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/output.py +10 -0
  22. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/prompt.py +10 -0
  23. tina_cli-0.1.3/src/tina/query.py +80 -0
  24. tina_cli-0.1.3/src/tina/scrub.py +60 -0
  25. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/sources/__init__.py +1 -0
  26. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/sources/base.py +24 -9
  27. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/sources/github.py +12 -2
  28. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/sources/jira.py +57 -15
  29. tina_cli-0.1.3/src/tina/validate.py +329 -0
  30. tina_cli-0.1.3/src/tina/verify.py +165 -0
  31. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/integration/test_cli.py +339 -3
  32. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_config.py +246 -0
  33. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_control.py +18 -0
  34. tina_cli-0.1.3/tests/unit/test_doctor.py +150 -0
  35. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_executors.py +28 -0
  36. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_harness.py +175 -1
  37. tina_cli-0.1.3/tests/unit/test_introspect.py +94 -0
  38. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_prompt.py +24 -0
  39. tina_cli-0.1.3/tests/unit/test_query.py +72 -0
  40. tina_cli-0.1.3/tests/unit/test_scrub.py +46 -0
  41. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_sources_github.py +37 -6
  42. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_sources_jira.py +102 -0
  43. tina_cli-0.1.3/tests/unit/test_validate.py +205 -0
  44. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_verify.py +91 -0
  45. {tina_cli-0.1.2 → tina_cli-0.1.3}/uv.lock +1 -1
  46. tina_cli-0.1.2/.release-please-manifest.json +0 -3
  47. tina_cli-0.1.2/src/tina/verify.py +0 -92
  48. {tina_cli-0.1.2 → tina_cli-0.1.3}/.github/workflows/ci.yml +0 -0
  49. {tina_cli-0.1.2 → tina_cli-0.1.3}/.github/workflows/pr-title.yml +0 -0
  50. {tina_cli-0.1.2 → tina_cli-0.1.3}/.github/workflows/release-please.yml +0 -0
  51. {tina_cli-0.1.2 → tina_cli-0.1.3}/.github/workflows/release.yml +0 -0
  52. {tina_cli-0.1.2 → tina_cli-0.1.3}/.gitignore +0 -0
  53. {tina_cli-0.1.2 → tina_cli-0.1.3}/AGENTS.md +0 -0
  54. {tina_cli-0.1.2 → tina_cli-0.1.3}/CLAUDE.md +0 -0
  55. {tina_cli-0.1.2 → tina_cli-0.1.3}/Dockerfile.reference +0 -0
  56. {tina_cli-0.1.2 → tina_cli-0.1.3}/LICENSE +0 -0
  57. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/README.md +0 -0
  58. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/agent.py +0 -0
  59. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/demo.sh +0 -0
  60. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/overlay.toml +0 -0
  61. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/queue.sh +0 -0
  62. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/record.sh +0 -0
  63. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/stub_server.py +0 -0
  64. {tina_cli-0.1.2 → tina_cli-0.1.3}/demo/workdir.sh +0 -0
  65. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/000-adr-template.md +0 -0
  66. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/001-orchestration-only-factory.md +0 -0
  67. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/002-no-scheduling-ownership.md +0 -0
  68. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/003-dispatch-worker-split.md +0 -0
  69. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/004-worker-side-claiming.md +0 -0
  70. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/005-harness-adapters-declarative-outcome-file.md +0 -0
  71. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/006-four-state-outcome-contract.md +0 -0
  72. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/007-generic-artifact-verification.md +0 -0
  73. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/008-tracks-installed-via-napoln.md +0 -0
  74. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/009-python.md +0 -0
  75. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/010-two-implementations-per-adapter-family.md +0 -0
  76. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/011-control-plane-data-plane-split.md +0 -0
  77. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/012-control-file-is-a-path.md +0 -0
  78. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/013-lifecycle-write-back-is-not-result-writing.md +0 -0
  79. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/014-claim-policy-per-track.md +0 -0
  80. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/015-sweep-tracks-run-without-a-work-item.md +0 -0
  81. {tina_cli-0.1.2 → tina_cli-0.1.3}/docs/adr/016-dispatch-budgets-by-live-executor-state.md +0 -0
  82. {tina_cli-0.1.2 → tina_cli-0.1.3}/examples/README.md +0 -0
  83. {tina_cli-0.1.2 → tina_cli-0.1.3}/examples/bug-triage/README.md +0 -0
  84. {tina_cli-0.1.2 → tina_cli-0.1.3}/examples/bug-triage/tina.toml +0 -0
  85. {tina_cli-0.1.2 → tina_cli-0.1.3}/examples/bug-triage/tracks/triage/SKILL.md +0 -0
  86. {tina_cli-0.1.2 → tina_cli-0.1.3}/justfile +0 -0
  87. {tina_cli-0.1.2 → tina_cli-0.1.3}/release-please-config.json +0 -0
  88. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/__init__.py +0 -0
  89. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/__main__.py +0 -0
  90. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/errors.py +0 -0
  91. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/executors/__init__.py +0 -0
  92. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/executors/base.py +0 -0
  93. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/executors/local.py +0 -0
  94. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/log.py +0 -0
  95. {tina_cli-0.1.2 → tina_cli-0.1.3}/src/tina/models.py +0 -0
  96. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/conftest.py +0 -0
  97. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_errors.py +0 -0
  98. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_output.py +0 -0
  99. {tina_cli-0.1.2 → tina_cli-0.1.3}/tests/unit/test_version.py +0 -0
  100. {tina_cli-0.1.2 → tina_cli-0.1.3}/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.3"
3
+ }
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.3](https://github.com/raiderrobert/tina/compare/v0.1.2...v0.1.3) (2026-09-07)
4
+
5
+
6
+ ### Features
7
+
8
+ * close the remaining gaps to a production factory ([#32](https://github.com/raiderrobert/tina/issues/32) P2–P5) ([cd3b58d](https://github.com/raiderrobert/tina/commit/cd3b58df86ca0359713ffc3bc9433a25b88c41db))
9
+ * **control:** pass a deployment's own tables through; qualify GitHub item ids ([a901269](https://github.com/raiderrobert/tina/commit/a901269ec649b995b537378afa6dd0de4c16cd20))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **harness:** flatten path separators in the artifact directory name ([8d412bc](https://github.com/raiderrobert/tina/commit/8d412bcd04366ebb11238d2cd14ba28562abf60f))
15
+ * **validate:** only prose references to paths/ and references/ must resolve ([3ea39ac](https://github.com/raiderrobert/tina/commit/3ea39ac78a013ee87aa770e9ce36fac21938e449))
16
+ * **verify:** check tracker web URLs through the API they describe ([43acd57](https://github.com/raiderrobert/tina/commit/43acd571a32d1f91b957cee593a7f02172b9b68f))
17
+
18
+
19
+ ### Documentation
20
+
21
+ * neutral example label in the structured-query examples ([9b05e90](https://github.com/raiderrobert/tina/commit/9b05e90fc9db8fc88d25ca9f105b9e645188fac0))
22
+
3
23
  ## [0.1.2](https://github.com/raiderrobert/tina/compare/v0.1.1...v0.1.2) (2026-08-27)
4
24
 
5
25
 
@@ -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.3
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,35 @@ 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, 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.
38
56
 
39
57
  Tina does not own scheduling. There is no open standard for declaring a schedule
40
58
  that targets native cloud schedulers, and cron dialects are not even portable
@@ -76,6 +94,35 @@ One track can produce different results per run: the vulnerability track
76
94
  ends in a PR link or a discovery comment depending on what it finds. Results are
77
95
  not 1:1 with tracks.
78
96
 
97
+ ### Structured query inputs
98
+
99
+ Most tracks are one query shape where a list changes: a project plus the set
100
+ of opted-in teams, a repo plus a label set. A track may give the parts instead
101
+ of the query, and Tina builds it (`tina.query`):
102
+
103
+ ```toml
104
+ [vul]
105
+ source = "jira"
106
+ project = "VUL"
107
+ extra = "labels not in (risk-exception)"
108
+ [vul.filters]
109
+ Squad = ["Reporting", "Site Experience"] # onboarding a team is one line
110
+
111
+ [smoke]
112
+ source = "github"
113
+ repo = "acme/api"
114
+ labels = ["needs-triage"]
115
+ ```
116
+
117
+ The builder owns the invariants every track would otherwise re-type into every
118
+ query string: the queued status, unassigned, not blocked, not claimed, oldest
119
+ first. Under `claim = "assign"` with a `claim_transition`, bot-held items still
120
+ in the queued status are offered back — the transition, not the assignee, is
121
+ what excludes an item, so one still queued was reopened upstream. Every value
122
+ interpolated is validated at load (charset, shape): a team name with a quote
123
+ in it is at best a broken query. `query` remains the full override for
124
+ anything that does not fit; a track may not set both.
125
+
79
126
  ### Sweep tracks
80
127
 
81
128
  Not every useful track has a queue: scan recent job executions and file an
@@ -103,8 +150,8 @@ Two roles, one image.
103
150
  jobs through an executor. It never runs an agent.
104
151
 
105
152
  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
153
+ `max(0, ceiling − in flight)`, where in flight is what the executor's
154
+ `running()` reports for the track
108
155
  ([ADR-016](adr/016-dispatch-budgets-by-live-executor-state.md)). Without the
109
156
  subtraction, a 15-minute scheduler launching the full limit against hour-long
110
157
  runs multiplies the knob by four to twelve. Items already in flight are
@@ -115,6 +162,23 @@ dispatch while its one worker is still out. A dry run builds no executor, so
115
162
  it assumes zero in flight and says so when that is an assumption rather than
116
163
  a fact.
117
164
 
165
+ The ceiling comes from three knobs, each at a different tier. The track's own
166
+ `max_concurrency` is declaration: a track that sets one has opted out of the
167
+ fleet knob, and only `paused` still stops it. Otherwise the control file's
168
+ `max_concurrency` applies — policy, changed without a deploy. `--limit` on
169
+ the command line can only lower whichever of those applies. With none of the
170
+ three set, the ceiling is 1. The dispatch record names which knob won, so a
171
+ cycle that launched fewer workers than expected is explainable from the log.
172
+
173
+ A deployment may also hand `dispatch_track` a **governor**
174
+ ([ADR-017](adr/017-governor-seam.md)): an object asked once per cycle for a
175
+ lower cap, and told afterwards what the cycle did — the ceiling, the cap that
176
+ applied, workers in flight, the budget, items matched, launches made. That is
177
+ the seam for adaptive throughput — halve on a failure burst, climb on healthy
178
+ deep-backlog cycles — reading signals Tina does not model. Tina ships no
179
+ governor; it can only lower the ceiling, and one that raises is treated as
180
+ absent for the cycle.
181
+
118
182
  **Worker** takes a single work item identifier, claims it, runs the agent once,
119
183
  and records the outcome. One item = one run = one container = one log stream.
120
184
 
@@ -240,8 +304,17 @@ query. All judgment about what the item actually is happens inside the track.
240
304
  | `claimed(q)` | `status` | the same query with its unclaimed clause inverted: what workers hold now |
241
305
  | `matches(item_id, q)` | worker | re-check the whole query against one item at worker start |
242
306
  | `claim(item)` | worker | mark the item as taken; fail if already claimed |
307
+ | `annotate(item, comment)`, `block(item)` | worker | lifecycle write-back after a bad run (§15) |
308
+ | `login()` | `doctor` | one authenticated read — who the credentials act as — and nothing else |
243
309
  | `normalize(payload)` | deferred | turn an inbound webhook payload into a work item |
244
310
 
311
+ Credentials come from the environment: `JIRA_BASE_URL`, `JIRA_EMAIL`,
312
+ `JIRA_API_TOKEN`; `GITHUB_TOKEN`, or `GH_TOKEN` — the GitHub CLI's spelling —
313
+ when that is what the image already carries. The bot's own identity is
314
+ configured (`JIRA_BOT_ACCOUNT_ID`, `GITHUB_BOT_LOGIN`) or looked up once from
315
+ the credentials (`/myself`, `/user`), so a deployment that rotates the bot
316
+ account changes one secret and nothing else.
317
+
245
318
  `matches` is the eligibility re-check: between dispatch and worker start an
246
319
  item can be assigned, closed, labeled, or worked by a human, and only the
247
320
  claim would notice — and only the assignee case. The worker re-checks the
@@ -264,6 +337,10 @@ ladder, and a 429 once, honoring a numeric `Retry-After` up to the minute the
264
337
  ladder allows. No other 4xx is ever retried, and a failure that outlives its
265
338
  ladder raises with the original status and message.
266
339
 
340
+ GitHub work items are identified as `owner/name#N` — an issue's identity is
341
+ its repo and its number, and the qualified form is unambiguous in a run
342
+ record or a log line. Every entry point also accepts the bare number.
343
+
267
344
  v1 ships **Jira** and **GitHub Issues**. Two adapters, not one — a single
268
345
  implementation makes the interface accidentally Jira-shaped, and an OSS project
269
346
  that cannot be tried without a Jira instance will not get used. GitHub Issues is
@@ -359,7 +436,7 @@ config rather than a code plugin:
359
436
  harness = "pi" # which one to use
360
437
 
361
438
  [harnesses.pi]
362
- command = ["pi", "--prompt-file", "{prompt_file}"]
439
+ command = ["pi", "-p", "@{prompt_file}"]
363
440
 
364
441
  [harnesses.claude]
365
442
  command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
@@ -381,7 +458,21 @@ a few hundred lines are multi-file (`paths/`, `references/`, `scripts/`), the
381
458
  agent runs with its working directory set to the run's temp workdir, and
382
459
  without the anchor every relative reference in the skill resolves nowhere.
383
460
  `SKILL.md`'s leading YAML frontmatter is stripped before inlining — it is
384
- adapter metadata, not prompt content.
461
+ adapter metadata, not prompt content. One token is substituted in the skill
462
+ body: `$WORK_ITEM_ID` becomes the item's tracker identifier, so a router can
463
+ open with "Work item: $WORK_ITEM_ID" without parsing the JSON block that
464
+ follows. It is the only runner token; `tina validate` rejects any other bare
465
+ `$TOKEN` in prose.
466
+
467
+ A harness table may carry `retry` rules: output markers that mean the
468
+ failure clears on its own — a model provider shedding load, a per-minute
469
+ quota — and a ladder of waits, one retry per entry. Rules are tried in
470
+ configured order, most specific first, and the first that matches decides the
471
+ schedule; once its ladder is spent the failure stands. With rules set, the
472
+ harness's output is relayed line by line so the markers can be seen — to
473
+ stderr, since stdout is Tina's JSON records. Without rules the output is
474
+ inherited and the harness runs exactly once. Tina still never *parses* that
475
+ output for an outcome: a marker is a reason to run again, not a report.
385
476
 
386
477
  `{session_dir}` is where the harness leaves its session — the transcript, tool
387
478
  calls, and token costs the final message never shows. A command referencing it
@@ -394,7 +485,11 @@ is best-effort — a capture failure is logged and never fails the run — and t
394
485
  destination is just a path, so a bucket mount works with no cloud code in
395
486
  Tina, the same reasoning as the control file. `artifacts_dir` unset skips the
396
487
  copy silently; `{session_dir}` still substitutes, so one harness table works
397
- in both environments.
488
+ in both environments. Text files are scrubbed of credential material on the
489
+ way (`tina.scrub`): a transcript records tool output verbatim, and an agent
490
+ that prints its environment lands every token it holds in one. Redaction is by
491
+ shape — GitHub and Atlassian tokens, JWTs, Basic auth, PEM keys — so the
492
+ scrubber holds no secrets of its own.
398
493
 
399
494
  **Tina does not parse harness stdout.** Each harness reports differently, and
400
495
  parsing per-harness output is where swappability rots. Instead Tina passes an
@@ -458,18 +553,19 @@ executor = "cloudrun" # selects [executors.cloudrun]
458
553
  tracks_dir = "tracks" # where napoln installed the skills
459
554
 
460
555
  [harnesses.pi]
461
- command = ["pi", "--prompt-file", "{prompt_file}"]
556
+ command = ["pi", "-p", "@{prompt_file}"]
462
557
 
463
558
  [executors.cloudrun]
464
559
  project = "acme-prod"
465
560
  region = "us-central1"
466
- job = "tina-worker"
561
+ job = "tina-{track}" # {track} optional: one job per track, sized per track
467
562
 
468
563
  [vul]
469
564
  source = "jira"
470
565
  query = "project = VUL AND status = Open AND assignee IS EMPTY"
471
566
  track = "remediate" # skill under tracks_dir; defaults to the key
472
567
  result = "github:pr" # declaration only
568
+ max_concurrency = 4 # this track's cap on live workers; opts out of the fleet knob
473
569
 
474
570
  [bug]
475
571
  source = "github"
@@ -523,8 +619,11 @@ activity in the logs. Per track, `on_failure` decides:
523
619
  - `"leave"` (default) — the item is untouched and retried next cycle.
524
620
  - `"annotate"` — the worker comments the effective status, the agent's
525
621
  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.
622
+ exclusion marker so the configured query stops matching it. The marker is a
623
+ label, `tina-blocked` unless the track sets `blocked_label`; a Jira track may
624
+ instead set `blocked_transition`, and the item moves to that status — the
625
+ query's own `status =` clause excludes it, and humans find the item in the
626
+ workflow state they already watch.
528
627
 
529
628
  It triggers on *effective* status: `failed`, `needs_human`, and `resolved`
530
629
  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
@@ -20,13 +20,20 @@ tracks_dir = "tracks"
20
20
  # control = "/mnt/config/control.toml"
21
21
 
22
22
  [harnesses.pi]
23
- command = ["pi", "--prompt-file", "{prompt_file}"]
23
+ command = ["pi", "-p", "@{prompt_file}"]
24
24
  # A command may also reference {model}; every track must then set `model`,
25
25
  # so each track picks the model its work deserves:
26
- # command = ["pi", "--prompt-file", "{prompt_file}", "--model", "{model}"]
26
+ # command = ["pi", "-p", "@{prompt_file}", "--model", "{model}"]
27
27
  # And {session_dir}: a fresh directory per run where the harness writes its
28
28
  # session, captured to artifacts_dir when that is set:
29
- # command = ["pi", "--prompt-file", "{prompt_file}", "--session-dir", "{session_dir}"]
29
+ # command = ["pi", "-p", "@{prompt_file}", "--session-dir", "{session_dir}"]
30
+ # Output markers that mean "the failure clears on its own — run it again",
31
+ # each with a ladder of waits (one retry per entry). Most specific first: the
32
+ # first rule that matches decides the schedule.
33
+ # retry = [
34
+ # { markers = ["Quota exceeded"], waits = [60, 300, 600], reason = "provider quota" },
35
+ # { markers = ["overloaded_error", "RESOURCE_EXHAUSTED"], waits = [30, 120], reason = "capacity" },
36
+ # ]
30
37
 
31
38
  [harnesses.claude]
32
39
  command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
@@ -35,6 +42,8 @@ command = ["claude", "-p", "@{prompt_file}", "--output-format", "json"]
35
42
  project = "acme-prod"
36
43
  region = "us-central1"
37
44
  job = "tina-worker"
45
+ # Or one job per track, so each gets its own machine size and timeout:
46
+ # job = "tina-{track}"
38
47
 
39
48
  # Every other table is a track: source -> skill -> result.
40
49
 
@@ -43,6 +52,8 @@ source = "jira"
43
52
  query = "project = VUL AND status = Open AND assignee IS EMPTY"
44
53
  track = "remediate" # skill name under tracks_dir; defaults to the key
45
54
  result = "github:pr" # declaration only — the agent produces it
55
+ # max_concurrency = 4 # this track's cap on live workers. Opts out of the
56
+ # # control file's max_concurrency; paused still applies.
46
57
  # model = "claude-sonnet-x" # substituted for {model} in the harness command;
47
58
  # # required exactly when the command references it
48
59
  # claim = "assign" # how the worker claims (ADR-014): "assign" the
@@ -62,6 +73,20 @@ result = "github:pr" # declaration only — the agent produces it
62
73
  # The query must exclude it, or blocked items match again. Jira:
63
74
  # AND (labels IS EMPTY OR labels != "tina-blocked")
64
75
  # GitHub: -label:tina-blocked
76
+ # blocked_transition = "Blocked" # jira only: block() transitions to this
77
+ # # status instead; the query's status clause
78
+ # # already excludes it.
79
+
80
+ # Instead of `query`, a track may give the parts and let tina build it —
81
+ # the queued status, unassigned, not blocked, not claimed, oldest first are
82
+ # then tina's job, and onboarding a team is one array edit:
83
+ # [vul-by-team]
84
+ # source = "jira"
85
+ # project = "VUL"
86
+ # status = "Open" # the default
87
+ # extra = "labels not in (risk-exception)"
88
+ # [vul-by-team.filters]
89
+ # Squad = ["Reporting", "Site Experience"]
65
90
 
66
91
  [bug]
67
92
  source = "github"
@@ -69,6 +94,8 @@ repo = "acme/api"
69
94
  query = "repo:acme/api is:issue is:open no:assignee label:bug"
70
95
  track = "triage"
71
96
  result = "github:issue-comment"
97
+ # The structured form of the same track:
98
+ # labels = ["bug"] # instead of query; repo is required either way
72
99
 
73
100
  # Optional: literal strings merged over the inherited environment for the
74
101
  # 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.3"
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"