gaslighting-engine 0.1.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.
Files changed (89) hide show
  1. package/.codex/prompts/gaslighting.md +30 -0
  2. package/.codex/skills/gaslighting/SKILL.md +96 -0
  3. package/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  4. package/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  5. package/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  6. package/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  7. package/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  8. package/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  9. package/LICENSE +21 -0
  10. package/README.md +200 -0
  11. package/dist/cli.js +118 -0
  12. package/dist/commands/agents.js +10 -0
  13. package/dist/commands/codexInstall.js +60 -0
  14. package/dist/commands/doctor.js +42 -0
  15. package/dist/commands/generate.js +4 -0
  16. package/dist/commands/init.js +27 -0
  17. package/dist/commands/skill.js +10 -0
  18. package/dist/commands/update.js +35 -0
  19. package/dist/core/analyze.js +132 -0
  20. package/dist/core/classifyProjectType.js +66 -0
  21. package/dist/core/content.js +125 -0
  22. package/dist/core/detectStackHints.js +34 -0
  23. package/dist/core/generateDocs.js +58 -0
  24. package/dist/core/generateGaslightingMarkdown.js +420 -0
  25. package/dist/core/generateOtherMarkdown.js +529 -0
  26. package/dist/core/generatePrdMarkdown.js +125 -0
  27. package/dist/index.js +3 -0
  28. package/dist/types.js +1 -0
  29. package/dist/utils/banner.js +49 -0
  30. package/dist/utils/date.js +6 -0
  31. package/dist/utils/file.js +24 -0
  32. package/dist/utils/logger.js +27 -0
  33. package/dist/utils/markdown.js +6 -0
  34. package/docs/codex-usage.md +58 -0
  35. package/docs/examples.md +22 -0
  36. package/docs/philosophy.md +17 -0
  37. package/docs/research.md +54 -0
  38. package/examples/ecommerce/.codex/prompts/gaslighting.md +30 -0
  39. package/examples/ecommerce/.codex/skills/gaslighting/SKILL.md +96 -0
  40. package/examples/ecommerce/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  41. package/examples/ecommerce/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  42. package/examples/ecommerce/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  43. package/examples/ecommerce/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  44. package/examples/ecommerce/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  45. package/examples/ecommerce/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  46. package/examples/ecommerce/AGENTS.md +47 -0
  47. package/examples/ecommerce/ASSUMPTIONS.md +146 -0
  48. package/examples/ecommerce/CODEX_PROMPT.md +34 -0
  49. package/examples/ecommerce/DECISION_LOG.md +95 -0
  50. package/examples/ecommerce/GASLIGHTING.md +429 -0
  51. package/examples/ecommerce/MEMORY.md +63 -0
  52. package/examples/ecommerce/MISSING_INFO.md +13 -0
  53. package/examples/ecommerce/PRD.md +115 -0
  54. package/examples/ecommerce/STACK_POLICY.md +64 -0
  55. package/examples/hospital-homepage/.codex/prompts/gaslighting.md +30 -0
  56. package/examples/hospital-homepage/.codex/skills/gaslighting/SKILL.md +96 -0
  57. package/examples/hospital-homepage/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  58. package/examples/hospital-homepage/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  59. package/examples/hospital-homepage/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  60. package/examples/hospital-homepage/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  61. package/examples/hospital-homepage/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  62. package/examples/hospital-homepage/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  63. package/examples/hospital-homepage/AGENTS.md +47 -0
  64. package/examples/hospital-homepage/ASSUMPTIONS.md +218 -0
  65. package/examples/hospital-homepage/CODEX_PROMPT.md +34 -0
  66. package/examples/hospital-homepage/DECISION_LOG.md +95 -0
  67. package/examples/hospital-homepage/GASLIGHTING.md +432 -0
  68. package/examples/hospital-homepage/MEMORY.md +66 -0
  69. package/examples/hospital-homepage/MISSING_INFO.md +13 -0
  70. package/examples/hospital-homepage/PRD.md +119 -0
  71. package/examples/hospital-homepage/STACK_POLICY.md +64 -0
  72. package/examples/landing-page/.codex/prompts/gaslighting.md +30 -0
  73. package/examples/landing-page/.codex/skills/gaslighting/SKILL.md +96 -0
  74. package/examples/landing-page/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  75. package/examples/landing-page/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  76. package/examples/landing-page/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  77. package/examples/landing-page/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  78. package/examples/landing-page/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  79. package/examples/landing-page/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  80. package/examples/landing-page/AGENTS.md +47 -0
  81. package/examples/landing-page/ASSUMPTIONS.md +146 -0
  82. package/examples/landing-page/CODEX_PROMPT.md +34 -0
  83. package/examples/landing-page/DECISION_LOG.md +95 -0
  84. package/examples/landing-page/GASLIGHTING.md +424 -0
  85. package/examples/landing-page/MEMORY.md +63 -0
  86. package/examples/landing-page/MISSING_INFO.md +13 -0
  87. package/examples/landing-page/PRD.md +103 -0
  88. package/examples/landing-page/STACK_POLICY.md +64 -0
  89. package/package.json +37 -0
@@ -0,0 +1,49 @@
1
+ export const brandName = "Gaslighting-engine";
2
+ export function printBanner(label) {
3
+ console.log(renderBanner(label));
4
+ }
5
+ export function renderBanner(label = "PROJECT DISCIPLINE RUNTIME") {
6
+ return `${ludgiAscii}
7
+ ${engineAscii}
8
+ ${operatorAscii}
9
+ ${brandName.toUpperCase()} // ${label}
10
+ `;
11
+ }
12
+ const ludgiAscii = String.raw `
13
+ _ _ _ ____ ____ ___
14
+ | | | | | || _ \ / ___|_ _|
15
+ | | | | | || | | | | _ | |
16
+ | |___ | |_| || |_| | |_| || |
17
+ |_____| \___/ |____/ \____|___|
18
+ `;
19
+ const engineAscii = String.raw `
20
+ _________ .__ .__ .__ __ .__
21
+ / _____/____ ______| | |__| ____ | |___/ |_|__| ____ ____
22
+ \_____ \\__ \ / ___/| | | |/ ___\| | \ __\ |/ \ / ___\
23
+ / \/ __ \_\___ \ | |_| / /_/ > Y \ | | | | \/ /_/ >
24
+ /_______ (____ /____ >|____/__\___ /|___| /__| |__|___| /\___ /
25
+ \/ \/ \/ /_____/ \/ \//_____/
26
+ ENGINE // NO FAKE COMPLETION
27
+ `;
28
+ const operatorAscii = String.raw `
29
+ ______________________
30
+ _.-"" ""-._
31
+ .-" .--. .--. "-.
32
+ .' /####\ /####\ '.
33
+ / |######| |######| \
34
+ / ____\####/________\####/____ \
35
+ | .' "" ____ "" '. |
36
+ | / .--------.-" "-.--------. \ |
37
+ | | / .====. \______/ .====. \ | |
38
+ | | | [######] .----. [######] | | |
39
+ | | | """" / .--. \ """" | | |
40
+ | | \_________/ /____\ \_________/ | |
41
+ \ | ___ .' '. ___ | /
42
+ \ | _.-" ""-.____.-"" "-._ | /
43
+ '| .-" ________________ "-. | .'
44
+ \ .-" __ __ "-. /
45
+ '._ / .' '. .' '. \ _.'
46
+ /___/ /\ \____/ /\ \___\
47
+ /___/__/ \________/ \__\___\
48
+ /______/ DISCIPLINE \______\
49
+ `;
@@ -0,0 +1,6 @@
1
+ export function isoDate(date = new Date()) {
2
+ const year = date.getFullYear();
3
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
4
+ const day = `${date.getDate()}`.padStart(2, "0");
5
+ return `${year}-${month}-${day}`;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ function variantName(filename) {
4
+ if (filename.endsWith(".md"))
5
+ return filename.replace(/\.md$/, ".new.md");
6
+ return `${filename}.new`;
7
+ }
8
+ export function writeDocs(targetDir, docs, force = false, dryRun = false) {
9
+ return docs.map((doc) => {
10
+ const intended = join(targetDir, doc.filename);
11
+ const exists = existsSync(intended);
12
+ const finalName = exists && !force ? variantName(doc.filename) : doc.filename;
13
+ const finalPath = join(targetDir, finalName);
14
+ if (dryRun)
15
+ return { filename: finalName, status: "dry_run" };
16
+ mkdirSync(dirname(finalPath), { recursive: true });
17
+ writeFileSync(finalPath, doc.content, "utf8");
18
+ if (exists && force)
19
+ return { filename: finalName, status: "overwritten" };
20
+ if (exists)
21
+ return { filename: finalName, status: "created_variant" };
22
+ return { filename: finalName, status: "created" };
23
+ });
24
+ }
@@ -0,0 +1,27 @@
1
+ import { printBanner } from "./banner.js";
2
+ export function printSummary(analysis, modeLines, results) {
3
+ printBanner("DOCUMENT GENERATOR");
4
+ console.log(`Detected project type: ${analysis.projectType}`);
5
+ console.log(`Confidence: ${analysis.confidence}`);
6
+ console.log("Detected stack hints:");
7
+ if (analysis.detectedStackHints.length === 0)
8
+ console.log("- none");
9
+ for (const hint of analysis.detectedStackHints)
10
+ console.log(`- ${hint}`);
11
+ console.log("\nMode:");
12
+ for (const line of modeLines)
13
+ console.log(`- ${line}`);
14
+ console.log("\nCreated:");
15
+ for (const result of results) {
16
+ const suffix = result.status === "created_variant"
17
+ ? " (existing file preserved)"
18
+ : result.status === "overwritten"
19
+ ? " (overwritten)"
20
+ : result.status === "dry_run"
21
+ ? " (dry run)"
22
+ : "";
23
+ console.log(`- ${result.filename}${suffix}`);
24
+ }
25
+ console.log('\nNext:\nOpen Codex and say:\n');
26
+ console.log('"Read GASLIGHTING.md, PRD.md, STACK_POLICY.md, MISSING_INFO.md, ASSUMPTIONS.md, DECISION_LOG.md, MEMORY.md, and AGENTS.md. Implement the MVP without shrinking scope, without TODO escape, and without fake completion."');
27
+ }
@@ -0,0 +1,6 @@
1
+ export function list(items) {
2
+ return items.map((item) => `- ${item}`).join("\n");
3
+ }
4
+ export function quote(value) {
5
+ return value.replaceAll("|", "\\|");
6
+ }
@@ -0,0 +1,58 @@
1
+ # Codex Usage
2
+
3
+ ## Recommended Install
4
+
5
+ Install the Codex-optimized project files:
6
+
7
+ ```bash
8
+ npx gaslighting-engine codex-install --force
9
+ ```
10
+
11
+ This installs:
12
+
13
+ - `.agents/skills/gaslighting/SKILL.md`
14
+ - `.agents/skills/gaslighting/agents/openai.yaml`
15
+ - `.codex/skills/gaslighting/SKILL.md`
16
+ - `.codex/skills/gaslighting/agents/openai.yaml`
17
+ - `.agents/prompts/gaslighting.md`
18
+ - `.codex/prompts/gaslighting.md`
19
+ - `CODEX_GASLIGHTING.md`
20
+
21
+ Then use the skill in Codex:
22
+
23
+ ```txt
24
+ $gaslighting
25
+ ```
26
+
27
+ or:
28
+
29
+ ```txt
30
+ Use the gaslighting skill.
31
+ ```
32
+
33
+ Some Codex app versions also show enabled skills in the slash command list. If `/gaslighting` does not appear, use `$gaslighting`.
34
+
35
+ Check the install:
36
+
37
+ ```bash
38
+ npx gaslighting-engine codex-doctor
39
+ ```
40
+
41
+ ## Generate Discipline Docs
42
+
43
+ Generate documents:
44
+
45
+ ```bash
46
+ gaslighting-engine "I want to build a hospital website."
47
+ ```
48
+
49
+ Then ask Codex:
50
+
51
+ ```txt
52
+ Read GASLIGHTING.md, PRD.md, STACK_POLICY.md, MISSING_INFO.md, ASSUMPTIONS.md, DECISION_LOG.md, MEMORY.md, and AGENTS.md.
53
+ Implement the MVP without shrinking scope, without TODO escape, and without fake completion.
54
+ ```
55
+
56
+ Codex should treat `AGENTS.md` as project guidance and `GASLIGHTING.md` as the anti-escape contract.
57
+
58
+ The CLI also generates Codex Skill files, prompt fallback files, and `CODEX_GASLIGHTING.md` so the workflow still works when a specific Codex surface does not expose a custom slash entry.
@@ -0,0 +1,22 @@
1
+ # Examples
2
+
3
+ Included examples:
4
+
5
+ - `examples/hospital-homepage`
6
+ - `examples/ecommerce`
7
+ - `examples/landing-page`
8
+
9
+ Regenerate them with:
10
+
11
+ ```bash
12
+ npm run build
13
+ node dist/index.js "I want to build a hospital website." --path examples/hospital-homepage --force
14
+ node dist/index.js "Build an ecommerce MVP with product catalog, cart, checkout, and admin orders." --type ecommerce --path examples/ecommerce --force
15
+ node dist/index.js "Build a landing page for a new service that captures leads." --type landing_page --path examples/landing-page --force
16
+ ```
17
+
18
+ Published usage:
19
+
20
+ ```bash
21
+ npx gaslighting-engine "I want to build a hospital website."
22
+ ```
@@ -0,0 +1,17 @@
1
+ # Philosophy
2
+
3
+ Gaslighting-engine exists because AI coding agents often confuse presentation with completion.
4
+
5
+ The generated documents force an agent to preserve scope, document uncertainty, and declare incomplete work honestly.
6
+
7
+ The pressure target is AI-agent behavior, not humans.
8
+
9
+ Core doctrine:
10
+
11
+ - Do the work.
12
+ - Do not pretend.
13
+ - Do not shrink the scope.
14
+ - Do not hide behind examples.
15
+ - Do not leave TODOs as fake implementation.
16
+ - If something is unfinished, say it is unfinished.
17
+ - Fake completion is the worst failure.
@@ -0,0 +1,54 @@
1
+ # Research Notes
2
+
3
+ Gaslighting-engine now treats context as a layered system instead of a single prompt.
4
+
5
+ ## Codex Findings
6
+
7
+ - Codex reads `AGENTS.md` before work and layers global/project guidance.
8
+ - Codex Skills package reusable workflow instructions, references, and scripts. Skills are available in CLI, IDE, and app surfaces.
9
+ - Codex App supports explicit Skill invocation with `$skill-name`; current app docs also state enabled skills can appear in the slash command list.
10
+ - Codex Memories can carry stable preferences and recurring workflows forward, but required team guidance should remain in checked-in files like `AGENTS.md`.
11
+ - Chronicle can enrich memories from screen context, but it is opt-in, platform-limited, and carries prompt-injection and privacy risks.
12
+ - Codex slash commands are strong for keyboard-first control, but custom slash-command availability differs by surface/version. The tool therefore treats `$gaslighting` and Skill metadata as the reliable path, while prompt files are fallback helpers.
13
+ - Codex Skill UI metadata can live in `agents/openai.yaml`, so generated skills include this file for better list/chip display where supported.
14
+
15
+ Sources:
16
+
17
+ - https://developers.openai.com/codex/guides/agents-md
18
+ - https://developers.openai.com/codex/skills
19
+ - https://developers.openai.com/codex/memories
20
+ - https://developers.openai.com/codex/memories/chronicle
21
+ - https://developers.openai.com/codex/guides/slash-commands
22
+
23
+ ## Hermes-Style Memory
24
+
25
+ Hermes Agent popularized a very explicit memory shape: persistent files for identity, user model, and project facts. The useful idea for this project is not copying Hermes. The useful idea is making memory inspectable, editable, and file-backed.
26
+
27
+ Gaslighting-engine applies this by generating `MEMORY.md`:
28
+
29
+ - stable project facts
30
+ - workflow preferences
31
+ - known agent failure patterns
32
+ - contradiction handling
33
+ - no-secrets rule
34
+
35
+ ## Hades-Style Audit
36
+
37
+ The useful Hades idea is ruthless cleanup with an audit ledger: remove dead code, suppressions, fake structure, and unverified claims, but make the operation explainable.
38
+
39
+ Gaslighting-engine applies this as:
40
+
41
+ - Hades-style audit rules in `MEMORY.md`
42
+ - no fake completion in `GASLIGHTING.md`
43
+ - decision traceability in `DECISION_LOG.md`
44
+ - doctor checks for required discipline files
45
+
46
+ ## Product Decision
47
+
48
+ The UX should be:
49
+
50
+ ```bash
51
+ gaslighting-engine "what I want to build"
52
+ ```
53
+
54
+ Options should be escape hatches, not required ceremony.
@@ -0,0 +1,30 @@
1
+ # /gaslighting
2
+
3
+ Read the Gaslighting-engine project-control files before doing any work:
4
+
5
+ 1. `GASLIGHTING.md`
6
+ 2. `PRD.md`
7
+ 3. `STACK_POLICY.md`
8
+ 4. `MISSING_INFO.md`
9
+ 5. `ASSUMPTIONS.md`
10
+ 6. `DECISION_LOG.md`
11
+ 7. `AGENTS.md`
12
+ 8. `MEMORY.md`
13
+
14
+ Then execute the user's requested implementation.
15
+
16
+ Rules:
17
+
18
+ - Preserve the full requested scope.
19
+ - Make reasonable assumptions and document them.
20
+ - Do not use TODO comments as fake implementation.
21
+ - Do not implement only representative examples.
22
+ - Do not say "the rest follows the same pattern."
23
+ - Do not call scaffolding completion.
24
+ - Do not call placeholders implementation.
25
+ - Do not over-engineer.
26
+ - Record stable project facts in `MEMORY.md`.
27
+ - Record product and technical decisions in `DECISION_LOG.md`.
28
+ - If something is incomplete, declare it explicitly.
29
+
30
+ Before claiming completion, perform the self-audit in `GASLIGHTING.md`.
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: gaslighting
3
+ description: Generate or update strict project discipline documents for Codex and AI coding agents. Use when a user asks to initialize Gaslighting, create GASLIGHTING.md/PRD.md/AGENTS.md discipline files, preserve full project scope, prevent TODO escape, prevent fake completion, or turn vague project intent into actionable control documents.
4
+ ---
5
+
6
+ # Gaslighting-engine Skill
7
+
8
+ You are a project-discipline generator for AI coding agents.
9
+
10
+ When a user gives a vague project request, do not stop and ask a long list of questions.
11
+
12
+ Instead:
13
+
14
+ 1. Infer the project type.
15
+ 2. Identify the project's core purpose.
16
+ 3. Make reasonable assumptions.
17
+ 4. Document assumptions clearly.
18
+ 5. Mark missing information clearly.
19
+ 6. Generate `GASLIGHTING.md`.
20
+ 7. Generate `PRD.md`.
21
+ 8. Generate `ASSUMPTIONS.md`.
22
+ 9. Generate `MISSING_INFO.md`.
23
+ 10. Generate `DECISION_LOG.md`.
24
+ 11. Generate `STACK_POLICY.md`.
25
+ 12. Generate or update `AGENTS.md`.
26
+
27
+ ## Hardcore Discipline Rule
28
+
29
+ The generated documents must prevent escape behavior.
30
+
31
+ Explicitly forbid:
32
+
33
+ - implementing only representative examples
34
+ - leaving TODOs instead of implementation
35
+ - saying "the rest can be done similarly"
36
+ - silently reducing requested scope
37
+ - pretending the task is complete
38
+ - replacing implementation with explanation
39
+ - creating empty placeholders
40
+ - skipping repetitive items because they are repetitive
41
+ - treating structure as completion
42
+ - treating direction as delivery
43
+
44
+ The agent must either:
45
+
46
+ 1. complete the full requested scope, or
47
+ 2. clearly declare what is incomplete.
48
+
49
+ Never allow fake completion.
50
+
51
+ Never allow scope shrinkage.
52
+
53
+ Never allow TODO-based escape.
54
+
55
+ ## Missing Information Rule
56
+
57
+ Missing information is not a free excuse to stop.
58
+
59
+ Classify missing information as:
60
+
61
+ - Confirmed
62
+ - Assumed
63
+ - Missing but non-blocking
64
+ - Missing and risky
65
+ - Missing and blocking
66
+
67
+ Only truly blocking information may stop implementation.
68
+
69
+ ## Default Tech Policy
70
+
71
+ For web projects, prefer:
72
+
73
+ - Next.js
74
+ - TypeScript
75
+ - Tailwind CSS
76
+ - shadcn/ui
77
+ - PostgreSQL
78
+ - NeonDB or Supabase
79
+ - Vercel
80
+ - Vercel Blob or Cloudflare R2
81
+ - GA4 + Google Tag Manager when analytics are needed
82
+ - Resend or equivalent when email is needed
83
+
84
+ Avoid over-engineering.
85
+
86
+ ## Output Rule
87
+
88
+ Create real markdown files.
89
+
90
+ Do not only explain.
91
+
92
+ Do not produce a plan without files.
93
+
94
+ Do not say what should be done.
95
+
96
+ Generate the actual project discipline documents.
@@ -0,0 +1,8 @@
1
+ interface:
2
+ display_name: "Gaslighting-engine"
3
+ short_description: "Generate strict Codex project discipline docs"
4
+ brand_color: "#111827"
5
+ default_prompt: "Use $gaslighting to generate Gaslighting-engine discipline documents before implementation."
6
+
7
+ policy:
8
+ allow_implicit_invocation: true