nobrainer-tech-flow 2.4.1 → 2.5.0

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.
@@ -9,7 +9,7 @@ trigger applies.
9
9
  | Need | Primary method |
10
10
  |---|---|
11
11
  | lifecycle, brief requirements, visible progress and guarded autonomy | `nobrainer-tech-flow` |
12
- | project-local Codex instruction discovery, byte-budget audit and context readback | `nobrainer-codex-context` |
12
+ | one project's instruction files across coding agents: what loads, size, duplicates, contradictions, one source of truth | `nobrainer-context` |
13
13
  | cross-project instruction, skill and task-prompt audit with coverage planning | `nobrainer-skill-doctor` |
14
14
  | capability selection, bounded native assignments or open-skill evaluation | `nobrainer-team` |
15
15
  | ready-set calculation, dependency batches, bounded dispatch and backpressure | `nobrainer-dispatcher` |
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  """Bounded advisory typed decisions; never executes selected actions."""
3
3
  import argparse
4
+ import functools
4
5
  import json
5
6
  import math
6
7
  import os
@@ -81,9 +82,8 @@ class NoRedirect(urllib.request.HTTPRedirectHandler):
81
82
  raise ValueError("redirect_not_allowed")
82
83
 
83
84
 
84
- def worker(provider, model, request):
85
+ def worker(provider, model, request, key=None):
85
86
  if provider == "jev":
86
- key = os.environ.get("TYPESAFE_API_KEY")
87
87
  if not key:
88
88
  return {"error": "MISSING_TYPESAFE_API_KEY"}
89
89
  payload = json.dumps(dict(request, model=model)).encode()
@@ -123,13 +123,19 @@ def worker(provider, model, request):
123
123
  return result
124
124
 
125
125
 
126
- def invoke(provider, model, request, timeout):
126
+ def invoke(provider, model, request, timeout, key_env=None):
127
+ # The child gets no credential from the environment. The TypeSafe key is read only
128
+ # from the variable the caller names with --key-env, and passed on stdin.
127
129
  env = {k: v for k, v in os.environ.items()
128
130
  if not any(part in k.upper() for part in ("KEY", "TOKEN", "SECRET", "PASSWORD", "CREDENTIAL"))}
129
- if provider == "jev" and os.environ.get("TYPESAFE_API_KEY"):
130
- env["TYPESAFE_API_KEY"] = os.environ["TYPESAFE_API_KEY"]
131
+ if key_env:
132
+ # The named variable may not look like a credential (TYPESAFE_AUTH, FOO); drop it anyway.
133
+ # Windows treats variable names without regard to case.
134
+ for name in [k for k in env if k == key_env or (os.name == "nt" and k.upper() == key_env.upper())]:
135
+ del env[name]
136
+ key = os.environ.get(key_env) if provider == "jev" and key_env else None
131
137
  process = subprocess.run([sys.executable, str(Path(__file__).resolve()), "--worker", provider, model],
132
- input=json.dumps(request), capture_output=True, text=True,
138
+ input=json.dumps({"request": request, "key": key}), capture_output=True, text=True,
133
139
  timeout=timeout, env=env)
134
140
  if process.returncode:
135
141
  raise ValueError("provider_failed")
@@ -182,9 +188,11 @@ def main():
182
188
  # Third-party stdout may contain progress or input; contain it.
183
189
  import contextlib
184
190
  import io
185
- request = validate_request(json.load(sys.stdin))
191
+ payload = json.load(sys.stdin)
192
+ request = validate_request(payload["request"])
193
+ key = payload.get("key") if isinstance(payload.get("key"), str) else None
186
194
  with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
187
- result = worker(sys.argv[2], sys.argv[3], request)
195
+ result = worker(sys.argv[2], sys.argv[3], request, key)
188
196
  print(json.dumps(result))
189
197
  return 0
190
198
  except Exception:
@@ -194,12 +202,15 @@ def main():
194
202
  parser.add_argument("--config", type=Path, default=Path(".nobrainer/flow.json"))
195
203
  parser.add_argument("--request", type=Path, help="JSON array of requests; otherwise stdin")
196
204
  parser.add_argument("--approved-data", action="store_true", help="Only with existing approval for this data and provider")
205
+ parser.add_argument("--key-env", metavar="NAME",
206
+ help="Jev only: the environment variable that holds your TypeSafe key; nothing is read without it")
197
207
  args = parser.parse_args()
198
208
  try:
199
209
  data = json.loads(args.request.read_text()) if args.request else json.load(sys.stdin)
200
210
  if not isinstance(data, list) or len(data) > 100:
201
211
  raise ValueError("batch")
202
- print(json.dumps(evaluate(data, read(args.config), args.approved_data), ensure_ascii=False))
212
+ call = functools.partial(invoke, key_env=args.key_env)
213
+ print(json.dumps(evaluate(data, read(args.config), args.approved_data, call), ensure_ascii=False))
203
214
  return 0
204
215
  except (OSError, ValueError, TypeError):
205
216
  print(json.dumps({"status": "CORE_FALLBACK", "reason": "INVALID_INPUT"}))
@@ -1,111 +0,0 @@
1
- ---
2
- name: nobrainer-codex-context
3
- description: "Use when setting up, auditing or repairing one project's Codex context; use nb-codex-context to inspect AGENTS files, configured fallbacks and byte limits, then make one evidence-backed project-local context change without changing global Codex configuration by default."
4
- ---
5
-
6
- # NoBrainer Codex Context
7
-
8
- Prepare the smallest useful project context for Codex. This skill owns the
9
- project-instruction boundary that Codex reads before a turn; it does not own
10
- model selection, subagent topology, session transfer, or the whole delivery
11
- workflow.
12
-
13
- ## Select a mode
14
-
15
- - `inspect` - read the current project root, instruction candidates, configured
16
- fallbacks, byte cap and effective document set. Do not write.
17
- - `setup` - inspect first, reconcile the existing instruction files, and add or
18
- update one marked project-local context block only when it improves the
19
- actual repository. Run the inspection again after the edit.
20
- - `repair` - fix a known context defect such as duplicate managed markers,
21
- stale generated content or a truncation-risk block. Do not rewrite unrelated
22
- instructions.
23
-
24
- Use `inspect` for a question. Use `setup` only when the owner asks to prepare
25
- the project or the project has a demonstrated context gap. A clean result is
26
- `CURRENT`; absence, truncation or an unknown runtime is evidence to report, not
27
- permission to invent a fix.
28
-
29
- ## Codex context contract
30
-
31
- Codex's effective project instructions are assembled from the nearest project
32
- root through the current directory. The normal candidates are
33
- `AGENTS.override.md` and `AGENTS.md`; configured fallback names are considered
34
- after them. The configured project-document byte budget applies to the loaded
35
- instruction set and defaults to the host's documented value when no override is
36
- read.
37
-
38
- Run the bundled read-only probe with Python 3.11+ before deciding what to change.
39
- Run it from the project, replacing `<context-skill-dir>` with this skill's
40
- directory wherever it is installed; the probe inspects the current directory,
41
- or the one given with `--cwd`:
42
-
43
- ```bash
44
- python3 <context-skill-dir>/scripts/codex_context.py --check --json
45
- ```
46
-
47
- The probe is an inventory and truncation check; its exit status does not prove
48
- that a live Codex client followed the instructions.
49
-
50
- When a project needs a durable NoBrainer context block, preserve all existing
51
- bytes and use exactly these markers in the applicable `AGENTS.md`:
52
-
53
- ```markdown
54
- <!-- NOBRAINER-CODEX-CONTEXT:START -->
55
- ## Project context
56
-
57
- - Source of truth: `<verified project files>`.
58
- - First checks: `<verified commands or tests>`.
59
- - Keep this block compact; link to deeper project docs instead of copying them.
60
- <!-- NOBRAINER-CODEX-CONTEXT:END -->
61
- ```
62
-
63
- Replace the placeholders only with facts read from the current project. Do not
64
- put credentials, private machine paths, mutable runtime state, guessed commands
65
- or model names in the block. If an existing managed block is present, update it
66
- in place; do not create a second one. If an `AGENTS.md` is absent, create it
67
- only when setup is explicitly requested and the project has enough inspected
68
- source facts to make the block useful.
69
-
70
- Do not create a `CODEX_CONTEXT.md` file and call it automatically loaded. Codex
71
- will only use an alternate filename when the host's `project_doc_fallback_filenames`
72
- configuration actually includes it; changing that global configuration is an
73
- owner-gated action outside this skill's default setup.
74
-
75
- ## Safe setup boundaries
76
-
77
- - Keep `AGENTS.override.md` precedence and client-managed blocks intact.
78
- - Never replace a whole `AGENTS.md` because it is long, old or from another
79
- client. Reduce duplication only when the exact duplicate and its owner are
80
- clear.
81
- - Do not edit `~/.codex/config.toml`, credentials, plugin installation or
82
- client settings unless the owner explicitly requests that separate action.
83
- - Do not claim `RUNTIME_VERIFIED` from a file read, probe exit code or installed
84
- skill. If `codex debug prompt-input` or `codex debug agents-md` is available,
85
- use it for a fresh readback; otherwise report `RUNTIME_READBACK: UNKNOWN`.
86
- - Keep the context block below the project's own required instructions when the
87
- file's structure makes that safer. Follow the nearest `AGENTS.md` rules.
88
-
89
- ## Closeout
90
-
91
- Return a compact readback:
92
-
93
- ```text
94
- CODEX_CONTEXT: CURRENT | UPDATED | BLOCKED
95
- PROJECT_ROOT: <path or UNKNOWN>
96
- DOCUMENTS: <ordered discovered files>
97
- FALLBACKS: <configured names or NONE>
98
- BYTE_BUDGET: <observed value or UNKNOWN>
99
- LOADED_BYTES: <observed value or UNKNOWN>
100
- TRUNCATED: YES | NO | UNKNOWN
101
- PROJECT_WRITE: NONE | AGENTS_BLOCK_UPDATED | AGENTS_CREATED
102
- RUNTIME_READBACK: VERIFIED | UNKNOWN | UNSUPPORTED
103
- OWNER_ACTION_REQUIRED: <one exact action or NONE>
104
- ROLLBACK: <exact preimage or NOT_APPLICABLE>
105
- ```
106
-
107
- Route portfolio-wide semantic instruction or skill audits to
108
- `nobrainer-skill-doctor`; keep one-project Codex context setup and repair here.
109
- Route broader setup, installation or delivery work back to `nobrainer-tech-flow`.
110
- Use `nobrainer-sessions` for context transfer and `nobrainer-review` for a
111
- release or adversarial closeout; do not duplicate their contracts here.