JWhoIsJaneTurner Research ← All articles
Preliminary experiment · Interactive reference

Belief engineering and code provenance

Can a system prompt that installs a worldview act like a distinct code author? Eight generated programs, two such authors, and a stylometry harness were used to explore how reliably authorship can be attributed and how large a foreign block of code must be before it is detected.

Preliminary results. The corpus is small (8 files, 154 functions, 2 authors, one task, one language), and the authors are personas of a single model. The figures below describe this corpus and are not established findings. They have not been replicated on other tasks, models or languages.
Version 0.1 (preliminary)6 October 2026Substrate model: claude-opus-4-8 (1M context)Interactive: tabs, chart, prompt viewer

What was tested

In the experiment, belief engineering refers to writing a system prompt that gives a model a complete worldview, a professional identity, or both, so that its output reflects that stance without being told which style to use. Two families of such prompts were used. In the first, two opposing philosophies of software (an emergent, domain-modelling holist and a reductionist, data-first empiricist) were stated as beliefs. In the second, two professional identities (a principal architect at a regulated firm and a scrappy startup data hacker) were given, each with a different client.

Every prompt asked for the same program: identify companies within thematic communities that are likely to be successful, innovative and disruptive. The task content was therefore constant, and any systematic difference in the code could be attributed to the persona.

Two questions were then asked of the resulting code. Attribution: can the persona that wrote a function be recovered from style alone? Provenance injection: if a block of functions from the opposite persona is spliced into a file, can a detector built from that file’s own functions flag it, without flagging other files by the same persona?

Background. The framing of prompts as belief systems was set out in an earlier essay, Prompt Engineering as Belief Engineering: How Identity Constraints Guide AI Outputs (Medium, May 2025), which argues that role and identity prompts narrow the range of outputs a model is likely to produce. The experiment below tests one consequence of that idea on code.

0.963
Function-level balanced accuracy on this corpus, logistic regression, leave-one-file-out
8 / 8
Files assigned to the correct persona
0.70 → 0.996
ROC-AUC for detecting a foreign block of 1 to 12 functions
154
Functions in the labelled corpus (114 + 40), 8 files, 341 features
Reading guide. The Method tab steps through the pipeline, Personas shows every prompt verbatim, Attribution reports the classifier results, and Detection has an explorable chart of detection power against insertion size. Takeaways collects the conclusions and the limits of the evidence.
Reproducibility. The attribution and injection results were reproduced by re-running the analysis script on a clean copy of the corpus. Logistic-regression accuracy and all six ROC-AUC values matched the stored results exactly. Random-forest results varied (see Attribution).

Method, step by step

The pipeline parses code with Python’s ast module and never executes it. Select a step, or use the buttons to advance.

The four personas

Authors were defined by system prompt alone. Author A comprises the holist prompt and the enterprise-architect prompt (one file from the first, three trials from the second). Author B comprises the empiricist prompt and the startup-hacker prompt, in the same proportions. Prompts are reproduced in full and unedited.


    
Two construction styles. The alpha and omega prompts state a metaphysical position and derive coding style from it. The enterprise and startup prompts instead give an identity, a ranked list of values, and a client with specific expectations. Both styles produced code that was separable by style alone, and the two styles were pooled into two authors on the basis of the structure they induced (class-based and layered versus flat and procedural).

Attribution

A classifier was trained on function-level features and evaluated with leave-one-file-out cross-validation: the model never saw any function from the file being scored. This prevents file-specific vocabulary from leaking between training and test data.

ClassifierFunction balanced accuracyFiles correctFunction confusion
Logistic regression0.9638 / 8A: 114 of 114 correct. B: 37 of 40 correct.
Random forest0.875 to 0.9587 / 8 to 8 / 8Varies with library version and seed; the 0.958 run gave A: 113 of 114, B: 37 of 40.
Nearest neighbour (file level)—8 / 8Between-author distance 2.49× the within-author distance.

The corpus, file by file

Functions of at least three lines were included. The table is ordered by author.

FileAuthorPromptLinesFunctionsClassesMean function length
alpha_solutionAAlpha73335258.7
enterprise_trial1AEnterprise978282617.6
enterprise_trial2AEnterprise752261914.8
enterprise_trial3AEnterprise788252115.0
omega_solutionBOmega25811017.2
startup_trial1BStartup21311014.0
startup_trial2BStartup18610012.1
startup_trial3BStartup1638011.2

Mean function length alone does not separate the authors (author B’s empiricist file averages 17.2 lines, longer than two of author A’s files). The separation comes from the combination of features, in particular the structure of the syntax tree inside each function, which is why simple summary statistics were insufficient and AST-path features were added.

Class imbalance. Author A contributes 114 functions and author B 40, so balanced accuracy is reported instead of raw accuracy. All three errors in the logistic-regression run were author-B functions assigned to author A.

Detection power versus insertion size

For each host file, a model of “normal” was built from that file’s own functions only. A probe block of k functions was then scored by the distance of its average feature vector from the host centroid. Foreign blocks came from the opposite author; native blocks came from other files by the host’s own author. ROC-AUC measures how well the score separates the two: 0.5 is chance and 1.0 is perfect separation. Each point is a mean over eight hosts, with the band showing ± one standard deviation across hosts.

Insertion size (functions)Mean ROC-AUCsd across hostsInterpretation

A plausible explanation for the size effect

One reading of the curve, not tested directly here: a block drawn from the host’s own author averages toward the host centroid, because the idiosyncrasies of individual functions cancel. A block from a different author carries a persistent structural bias that does not cancel as functions are added. On that reading, the signal grows with block size while the noise shrinks, so detection power would depend on the size of the contested region rather than on any single function.

Preliminary observations

Limits of the evidence

What would make this solid

Replication is needed before these figures are treated as findings. The natural extensions are more authors and tasks, a second language, real developer-edited insertions, and stronger detectors evaluated against the same curve. The measurement scripts and results file are retained so that any extension can be compared to the baseline reported here.