Skip to content

Commit abeb319

Browse files
committed
Refresh README, enable runtime writes, add plans
Update README CLI guidance to reflect the manifest-driven workflow: reorganize examples into Inspect/Execute/Trajectory sections, clarify `nqctl act` vs `actions list` vs `capabilities`, and remove legacy parameter-authoring commands. Change runtime defaults in config/default_runtime.yaml to allow_writes: true and dry_run: false. Add planning/design and implementation documents under docs/plans that describe an anchor-based cutoff for Nanonis action discovery (Bias_Set) and the README refresh implementation steps, including testing and verification guidance.
1 parent 1d940f2 commit abeb319

6 files changed

+487
-49
lines changed

README.md

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -65,105 +65,111 @@ python -m pip install ".[nanonis]"
6565

6666
Runtime config controls host, candidate ports, timeout, backend, write policy, and trajectory settings.
6767

68-
## CLI quickstart (`nqctl`)
68+
## CLI command guide (`nqctl`)
6969

70-
Show capability contract:
70+
### Inspect and introspect
7171

72-
```powershell
73-
nqctl capabilities
74-
```
75-
76-
Read one parameter:
72+
Get the machine-readable CLI contract (parameters, action commands, policy):
7773

7874
```powershell
79-
nqctl get bias_v
75+
nqctl capabilities
8076
```
8177

82-
Guarded single-step set:
78+
Include backend command discovery from the active backend:
8379

8480
```powershell
85-
nqctl set bias_v 0.12
81+
nqctl capabilities --include-backend-commands --backend-match Scan
8682
```
8783

88-
Explicit guarded ramp:
84+
List observable parameter metadata and high-level CLI action descriptors:
8985

9086
```powershell
91-
nqctl ramp bias_v 0.10 0.25 0.01 --interval-s 0.10
87+
nqctl observables list
88+
nqctl actions list
9289
```
9390

94-
Invoke one manifest action command:
95-
96-
```powershell
97-
nqctl act Scan_Action --arg Scan_action=0 --arg Scan_direction=1
98-
```
99-
100-
Inspect effective policy:
91+
Inspect active policy, backend command inventory, and connectivity preflight:
10192

10293
```powershell
10394
nqctl policy show
95+
nqctl backend commands --match Bias
96+
nqctl doctor --command-probe
10497
```
10598

106-
## Trajectory monitor quickstart (`nqctl`)
99+
### Execute operations
107100

108-
Inspect monitor defaults and available labels:
101+
Read one parameter:
109102

110103
```powershell
111-
nqctl trajectory monitor config show
112-
nqctl trajectory monitor list-signals
113-
nqctl trajectory monitor list-specs
104+
nqctl get bias_v
114105
```
115106

116-
Stage a run configuration (required before each run):
107+
Apply guarded strict single-step write:
117108

118109
```powershell
119-
nqctl trajectory monitor config set --run-name gui-play-001 --interval-s 0.1 --rotate-entries 6000 --action-window-s 2.5
110+
nqctl set bias_v 0.12
120111
```
121112

122-
Start monitoring (foreground; stop with `Ctrl+C`):
113+
Apply explicit guarded ramp:
123114

124115
```powershell
125-
nqctl trajectory monitor run
116+
nqctl ramp bias_v 0.10 0.25 0.01 --interval-s 0.10
126117
```
127118

128-
Inspect action trajectory from SQLite:
119+
Invoke one manifest action command with argument overrides:
129120

130121
```powershell
131-
nqctl trajectory action list --db-path artifacts/trajectory/trajectory-monitor.sqlite3 --run-name gui-play-001
132-
nqctl trajectory action show --db-path artifacts/trajectory/trajectory-monitor.sqlite3 --run-name gui-play-001 --action-idx 0 --with-signal-window
122+
nqctl act Scan_Action --arg Scan_action=0 --arg Scan_direction=1
133123
```
134124

135-
Notes:
136-
- `run_name` is cleared after each monitor run, so set it again before the next run.
137-
- Action entries use ISO UTC timestamps and include `delta_value` for numeric spec changes.
138-
- Legacy JSONL readers remain available via `nqctl trajectory tail` and `nqctl trajectory follow`.
125+
### `act` vs action metadata
139126

140-
JSON is the default output format. Use `--text` for human-readable key/value output.
127+
- `nqctl act <action_name> --arg key=value` executes one backend action command from
128+
the manifest `actions` section.
129+
- `nqctl actions list` lists CLI-level action descriptors (what workflows the CLI
130+
supports, with safety hints and templates).
131+
- `nqctl capabilities` exposes executable manifest action inventory under
132+
`action_commands.items[*]` (command name, args, arg types, safety mode).
141133

142-
Help shortcuts:
134+
### Trajectory commands
135+
136+
Legacy JSONL readers:
143137

144138
```powershell
145-
nqctl -help
146-
nqctl -help parameters
139+
nqctl trajectory tail --directory artifacts/trajectory --limit 20
140+
nqctl trajectory follow --directory artifacts/trajectory --interval-s 0.5
147141
```
148142

149-
## Parameter extension workflow
150-
151-
Discover candidate backend commands:
143+
SQLite action queries:
152144

153145
```powershell
154-
nqctl parameters discover --match LockIn
146+
nqctl trajectory action list --db-path artifacts/trajectory/trajectory-monitor.sqlite3 --run-name gui-play-001
147+
nqctl trajectory action show --db-path artifacts/trajectory/trajectory-monitor.sqlite3 --run-name gui-play-001 --action-idx 0 --with-signal-window
155148
```
156149

157-
Regenerate the unified parameter manifest:
150+
Monitor config and run loop:
158151

159152
```powershell
160-
python scripts/generate_parameters_manifest.py --output config/parameters.yaml
153+
nqctl trajectory monitor config show
154+
nqctl trajectory monitor config set --run-name gui-play-001 --interval-s 0.1 --rotate-entries 6000 --action-window-s 2.5
155+
nqctl trajectory monitor list-signals
156+
nqctl trajectory monitor list-specs
157+
nqctl trajectory monitor run
158+
nqctl trajectory monitor config clear
161159
```
162160

163-
Validate parameter YAML:
161+
Notes:
162+
- `run_name` is cleared after each monitor run attempt; set it again before the next run.
163+
- Action entries use ISO UTC timestamps and include `delta_value` for numeric spec changes.
164+
165+
### Output and help
166+
167+
JSON is the default output format. Use `--text` for human-readable key/value output.
164168

165169
```powershell
166-
nqctl parameters validate --file config/parameters.yaml
170+
nqctl -help
171+
nqctl -help trajectory
172+
nqctl -help act
167173
```
168174

169175
## QCodes usage

config/default_runtime.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ nanonis:
1111
backend: "adapter"
1212

1313
safety:
14-
allow_writes: false
15-
dry_run: true
14+
allow_writes: true
15+
dry_run: false
1616
default_ramp_interval_s: 0.05
1717

1818
trajectory:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Action Surface Cutoff Design
2+
3+
Date: 2026-02-24
4+
5+
## Goal
6+
7+
Constrain manifest import to the intended Nanonis command surface by ignoring
8+
class-callable members declared before `Bias_Set` in `nanonis_spm.Nanonis`.
9+
This removes internal helper methods from generated `actions` while preserving
10+
the current Get/Set parameter extraction and action generation flow.
11+
12+
## Decision
13+
14+
Use positional anchoring (Option 1):
15+
16+
- Discover candidate methods in class declaration order.
17+
- Find `Bias_Set` as the anchor.
18+
- Exclude all callable members before the anchor.
19+
- Keep existing manifest behavior after discovery (split Get/Set to
20+
`parameters`, non-Get/Set to `actions`).
21+
22+
Rationale:
23+
24+
- Matches the requested contract exactly.
25+
- Simple, deterministic, and low maintenance for a mostly stable upstream
26+
class layout.
27+
28+
## Design
29+
30+
### Discovery pipeline
31+
32+
Update `discover_nanonis_commands` in
33+
`nanonis_qcodes_controller/qcodes_driver/manifest_generator.py`:
34+
35+
1. Read ordered members from `nanonis_spm.Nanonis.__dict__.items()`.
36+
2. Keep callable members that do not start with `_`.
37+
3. Locate the first member named `Bias_Set`.
38+
4. Slice the ordered member list from `Bias_Set` onward.
39+
5. Apply optional `match_pattern` filtering.
40+
6. Build `CommandInfo` entries from remaining members.
41+
7. Sort resulting commands by command name before returning (to keep stable
42+
generated YAML ordering independent of declaration order).
43+
44+
### Error handling
45+
46+
- If `Bias_Set` is not found in callable members, raise `ValueError` with a
47+
clear message indicating that command discovery cannot establish the Nanonis
48+
anchor.
49+
50+
### Compatibility
51+
52+
- No schema changes to `config/parameters.yaml`.
53+
- No CLI contract changes (`nqctl capabilities`, `nqctl act` stay the same).
54+
- Existing curated merge behavior remains unchanged.
55+
56+
## Testing strategy
57+
58+
Add/extend tests in `tests/test_parameter_manifest_generator.py`:
59+
60+
- Verify methods before `Bias_Set` are excluded by discovery.
61+
- Verify methods at/after `Bias_Set` are included.
62+
- Verify missing-anchor behavior raises a clear `ValueError`.
63+
64+
Run focused tests first, then full project checks before any release actions.
65+
66+
## Risks and mitigations
67+
68+
- Risk: upstream reorders class members unexpectedly.
69+
- Mitigation: fail fast when anchor is missing; tests exercise cutoff logic.
70+
- Risk: inherited members might not appear in `__dict__`.
71+
- Mitigation: this design intentionally tracks the concrete class declaration
72+
surface; if upstream moves methods to a base class, update discovery rule
73+
explicitly in a follow-up.

0 commit comments

Comments
 (0)