Skip to content

A skill to stop your coding agent from burying the answer. ADHD-friendly output.

feat(pi): add config file with alwaysOn and hideStatus options

Hikki04376f8dd081
diff --git a/INSTALL.md b/INSTALL.md
index 8a5cd49..465d19e 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -513,6 +513,22 @@ Back to on-demand:
rm ~/.pi/agent/.i-have-adhd-always
```
+### Config file (optional)
+
+Create `~/.pi/agent/i-have-adhd.json` in Pi's agent configuration directory:
+
+```json
+{
+ "alwaysOn": true,
+ "hideStatus": true
+}
+```
+
+- `alwaysOn`: start every session with the rules active — same as the `.i-have-adhd-always` flag file, which still works
+- `hideStatus`: keep the `● ADHD ON` status-bar entry hidden; the rules and the `/i-have-adhd` command still work
+
+Read once at extension startup, so restart Pi after changing it. A saved choice for the current session wins over `alwaysOn`, so `stop adhd mode` keeps that session disabled.
+
If `PI_CODING_AGENT_DIR` is set, put `.i-have-adhd-always` in that directory instead. Run `/reload` or start a new session after changing the flag.
</details>
diff --git a/extensions/i-have-adhd.ts b/extensions/i-have-adhd.ts
index 351a3b8..c994f79 100644
--- a/extensions/i-have-adhd.ts
+++ b/extensions/i-have-adhd.ts
@@ -34,6 +34,20 @@ type AdhdModeState = {
enabled: boolean;
};
+type AdhdConfig = {
+ hideStatus?: boolean;
+};
+
+function loadConfig(): AdhdConfig {
+ try {
+ return JSON.parse(
+ readFileSync(join(getAgentDir(), "i-have-adhd.json"), "utf8"),
+ );
+ } catch {
+ return {};
+ }
+}
+
function stripFrontmatter(content: string): string {
return content
.replace(
@@ -98,10 +112,11 @@ function rulesAreInContext(ctx: ExtensionContext): boolean {
export default function iHaveAdhdExtension(pi: ExtensionAPI) {
const rules = loadRules();
const alwaysOnFlag = join(getAgentDir(), ".i-have-adhd-always");
+ const config = loadConfig();
let enabled = false;
const updateStatus = (ctx: ExtensionContext): void => {
- if (!enabled) {
+ if (!enabled || config.hideStatus) {
ctx.ui.setStatus(STATUS_KEY, undefined);
return;
}
@@ -145,7 +160,9 @@ export default function iHaveAdhdExtension(pi: ExtensionAPI) {
const restoreState = (ctx: ExtensionContext): void => {
const savedState = getSavedState(ctx);
const enabledByDefault =
- pi.getFlag("adhd") === true || existsSync(alwaysOnFlag);
+ pi.getFlag("adhd") === true ||
+ config.alwaysOn === true ||
+ existsSync(alwaysOnFlag);
enabled = savedState ?? enabledByDefault;
updateStatus(ctx);