{"slug": "build-a-30-line-provenance-log-for-ai-generated-code", "title": "Build a 30-Line Provenance Log for AI-Generated Code", "summary": "A developer proposes a 30-line provenance log for AI-generated code using an append-only JSONL file. The log records task, constraints, model, commits, verification, and human decisions without exposing secrets. This creates a searchable chain from intent to evidence, making generated code replaceable while preserving decisions.", "body_md": "“Control the ideas, not the code” is trending today. For a small team, the practical question is how to preserve decisions when code becomes cheap to regenerate.\n\nUse an append-only JSONL log. It should record the task, constraints, model or tool, input commit, accepted output commit, verification command, and human decision—never raw secrets or an entire private prompt.\n\n``` js\nimport { appendFileSync } from \"node:fs\";\nimport { execFileSync } from \"node:child_process\";\n\nconst git = (...args) => execFileSync(\"git\", args, { encoding: \"utf8\" }).trim();\nconst entry = {\n  at: new Date().toISOString(),\n  task: process.argv[2],\n  constraints: process.argv[3].split(\",\"),\n  input: git(\"rev-parse\", \"HEAD\"),\n  verify: process.argv[4],\n  decision: \"pending\"\n};\nappendFileSync(\".provenance.jsonl\", JSON.stringify(entry) + \"\\n\");\n```\n\nCommit the log beside an architecture decision record. After review, add a second event containing the output commit, test result, reviewer, and accept/reject reason. Events are safer than rewriting history because retries and reversals remain visible.\n\nThis does not prove authorship, correctness, or license compatibility. It creates a searchable chain from intent to evidence. That chain lets you replace a model, regenerate an implementation, or explain why a strange constraint exists six months later.\n\nThe durable asset is not a pile of generated lines. It is the verified intent that makes those lines replaceable.", "url": "https://wpnews.pro/news/build-a-30-line-provenance-log-for-ai-generated-code", "canonical_source": "https://dev.to/rivera123/build-a-30-line-provenance-log-for-ai-generated-code-32bi", "published_at": "2026-07-13 14:16:11+00:00", "updated_at": "2026-07-13 14:17:50.612994+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-agents", "mlops", "generative-ai"], "entities": [], "alternates": {"html": "https://wpnews.pro/news/build-a-30-line-provenance-log-for-ai-generated-code", "markdown": "https://wpnews.pro/news/build-a-30-line-provenance-log-for-ai-generated-code.md", "text": "https://wpnews.pro/news/build-a-30-line-provenance-log-for-ai-generated-code.txt", "jsonld": "https://wpnews.pro/news/build-a-30-line-provenance-log-for-ai-generated-code.jsonld"}}