Artifact

Implementation Justification

A specification for coding agents to evaluate whether code serves a legitimate purpose and whether its complexity is warranted, with evidence and scope rules for simplifying new code and reviewing existing code.

concept published

Conceptual and architectural specification for code de-slopification

Version 1.0 ยท 29 November 2026

1. Purpose

Implementation justification is the systematic evaluation of whether an implementation element serves a legitimate purpose and whether its complexity is proportionate to that purpose and its constraints.

Code de-slopification is the application of implementation justification to identify and eliminate unjustified functionality and implementation complexity while preserving intended behavior, architectural integrity, and operational guarantees.

The objective is justified simplicity, not absolute minimalism. Every element should earn its existence; fewer lines of code are neither necessary nor sufficient evidence of improvement.

This specification defines a shared reasoning capability and two invocation capabilities. It is independent of programming language, agent harness, orchestration framework, and organizational development practice. It is a source specification for deriving skills, not itself an executable skill.

2. Definitions

  • Functional slop: functionality or implementation artifacts that serve no legitimate requirement or constraint.
  • Implementation slop: unnecessary complexity in the implementation of legitimate functionality. Such code may be reachable, correct, and thoroughly tested.
  • Legitimate purpose: a defensible functional, architectural, operational, security, compatibility, or maintainability need supported by evidence. Explicitly authorized future requirements can qualify; imagined future needs do not establish justification.
  • Authorized change scope: the work assigned to the implementing agent, including modifications necessary to fulfill that assignment. Merely touching a file or function does not authorize unrelated remediation.
  • Established code: implementation outside the current authorized generation or modification scope, regardless of its age or authorship.

Slop is contextual, not an intrinsic property of a programming pattern. A retry mechanism may be essential at an unreliable network boundary and unjustified in a deterministic local calculation. Human and AI authorship are subject to the same evaluation.

3. Foundational principles

  1. Justification of existence: every implementation element should serve a defensible purpose.
  2. Proportionality: complexity should be commensurate with requirements and constraints.
  3. Asymmetric burden of proof: justify inclusion for new implementation; justify removal or replacement for established implementation.
  4. Behavior first: understand requirements, contracts, and observable behavior before proposing changes.
  5. Bounded authority: investigation may extend beyond assigned scope; autonomous remediation may not.
  6. Separation of judgment and action: a finding does not authorize a change. Discovery does not confer authority.
  7. Evidence over preference: patterns and metrics are investigative signals, not automatic verdicts.
  8. Sufficiency: stop when implementation is defensible; do not pursue theoretical minimalism or stylistic churn.

4. Conceptual architecture

The architecture consists of three capabilities: a shared implementation justification capability and two front ends, preventative and remedial. The shared capability evaluates and produces findings; the front ends establish invocation context, applicable burden of proof, and action policy.

Automatic and manual review share implementation justification and produce evidence-supported findings. Invocation and scope determine whether to correct and validate, report and continue, or recommend a human decision. All three paths return to the integrating system.

The shared capability does not independently authorize remediation. Its conceptual inputs are the implementation under evaluation, requirements, relevant project context, constraints, and evidence. Its outputs are findings and, where supportable, suggested alternatives.

4.1 Preventative front end

Automatically invoked as part of new code generation. The integrating system determines the precise invocation point or points. The generating agent must justify the implementation it introduces and may simplify or remove its own unnecessary additions and modifications within the assigned change scope. It must validate corrections before completion.

When investigation identifies slop in established code outside that scope, the agent records a finding and optionally suggests remediation. It must not modify that code, expand the assignment, create an additional completion criterion, or block otherwise satisfactory work because of that finding.

4.2 Remedial front end

Manually invoked for investigation of implementation, normally established code. It evaluates the requested subject, develops evidence-supported findings, and may recommend specific corrections. A human developer must review findings and make the final action decision. Manual invocation alone does not authorize implementation changes, including changes to newly generated code.

4.3 Authority matrix

Invocation Subject Permitted disposition
Automatic New or modified implementation within assigned scope Investigate, correct, validate, report
Automatic Established implementation outside assigned scope Investigate, report, optionally suggest; do not modify or block
Manual Any implementation Investigate, report, optionally suggest; await human decision

Investigation and verification must respect the same modification boundary. For example, creating persistent characterization tests in established code is not implicitly authorized by an investigative invocation. Existing tests and permitted non-mutating inspection can be used; proposed tests may be included in findings.

5. Shared evaluation methodology

5.1 Anchor on behavior first

Establish intended behavior from requirements, contracts, and documented constraints. For established code, characterize current behavior at meaningful module boundaries using existing tests, authorized characterization tests, and observable execution. Distinguish observed behavior from intended behavior: a characterization test can capture a defect without legitimizing it.

Trace actual execution and data flow from entry to exit. Account for indirect calls, reflection, framework lifecycle hooks, configuration, generated code, external consumers, and failure paths before declaring an element unused or unreachable. Inspect relevant upstream guarantees and downstream obligations.

For each element or cohesive group of elements, establish its purpose, legitimacy, actual contribution, and consequences of absence or replacement. Where evidence is insufficient, preserve uncertainty rather than inventing intent.

5.2 Strip speculative complexity

Apply YAGNI (You Aren't Gonna Need It) and the Rule of Three as heuristics, not mandatory thresholds. Investigate premature interfaces, factories, wrapper classes, pass-through layers, generic helpers, configuration options, and speculative extension points. Prefer direct invocation when abstraction contributes no defensible value.

Identify dead code, unused imports and parameters, unreachable fallbacks, duplicated functionality, and redundant checks. Establish that upstream invariants actually hold and that removal does not violate external contracts or trust boundaries. Preserve meaningful security, reliability, compatibility, and error-handling safeguards.

Remove comments and documentation that merely narrate obvious code. Preserve explanations of non-obvious intent, constraints, tradeoffs, and contracts. Evaluate tests for meaningful behavioral assertions rather than mock verification or redundant coverage alone. Evaluate logging for diagnostic value, not volume alone.

A single-use abstraction may still provide a legitimate architectural boundary, readability benefit, or isolation of side effects. The number of consumers alone does not decide its legitimacy.

5.3 Flatten control flow and state

Prefer direct, idiomatic expression of legitimate functionality. Consider guard clauses to reduce nesting; consolidate related state where this clarifies relationships; isolate side effects where practical; replace unnecessary custom loops, parsers, and utilities with suitable standard library or existing project functionality.

Evaluate alternatives against project conventions and architectural decisions. Preserve transaction boundaries, evaluation order, resource cleanup, concurrency guarantees, error propagation, performance constraints, and observable contracts. Do not impose a new programming paradigm or architecture in the name of simplification.

5.4 Verify with objective signals

Compare the original and proposed implementation using relevant evidence. Run the project's established behavioral tests, formatting, linting, type checking, and static analysis where available and authorized. Avoid introducing unrelated formatting changes or tooling requirements.

Signal Interpretation
Net deletion Useful evidence of reduced surface area, not a quota
Cyclomatic and cognitive complexity Prefer fewer unnecessary paths and less reasoning burden
Indirection depth Prefer fewer unjustified hops
Mutable state and dependencies Prefer less unnecessary state and ownership
Public API surface Avoid unjustified expansion; preserve required contracts
Behavioral tests Preserve required behavior; verify proposed corrections
Static analysis Resolve relevant findings without suppressing legitimate warnings

No individual metric proves improvement. A shorter implementation may be harder to understand; a longer implementation may be better justified. Record unavailable verification and distinguish predicted improvements from measured results. Do not claim tests passed when they were not run.

5.5 Recognize sufficient justification

Conclude the evaluation when legitimate requirements are satisfied, complexity is reasonably proportionate, and no further evidence-supported simplification has been identified. Alternatives that amount to personal preference are not findings of slop. Unresolved uncertainty may be reported without forcing a correction.

Avoid repeated refactoring of equally defensible implementations. The process is not an exhaustive search for the globally smallest or fastest program.

6. Findings and classification

Classification Meaning
Justified Purpose and implementation are defensible.
Partially justified Purpose is legitimate, but some implementation complexity is demonstrably unnecessary.
Unjustified Sufficient evidence establishes that the element or functionality lacks a legitimate purpose.
Indeterminate Available evidence is insufficient to establish justification or its absence.

An unknown justification is not proof of an unjustified implementation. For new code, investigate uncertainty before retaining speculative additions; for established code, preserve it absent sufficient evidence and authorization. Classifications describe the implementation, not the permission to change it.

A finding should be sufficiently self-contained for a human or another agent to evaluate without reconstructing the original investigation. Its conceptual contents are:

  • Subject and location: implementation and relevant scope.
  • Classification and purpose: conclusion and apparent or established role.
  • Evidence: requirements, code paths, contracts, tests, measurements, or other support.
  • Justification deficit: specific unnecessary functionality or complexity, where applicable.
  • Consequences: known or potential effects of removal or replacement.
  • Suggested remediation: optional, only where a defensible alternative exists.
  • Uncertainty: assumptions, unresolved questions, missing evidence, and verification limitations.
  • Disposition: corrected and validated, reported without modification, pending human decision, or no correction warranted.

A suggestion is not an instruction. A finding is not authorization. Do not fabricate a remediation merely to populate a field.

7. Integration responsibilities

The integrating system supplies assigned scope and invocation context, exposes appropriate investigation and verification tools, receives findings, and manages their lifecycle. In an orchestrated development environment, findings and correction outcomes return to the orchestrator for the normal development cycle.

Prioritization, deduplication, persistence, serialization, scheduling, approval workflows, and task assignment belong to the integrating system. The specification does not prescribe a skill format, storage mechanism, tool interface, agent topology, or exact invocation hook. The two front ends may be implemented differently in different environments while sharing the same methodology and authority constraints.

8. Illustrative acceptance scenarios

These scenarios are derived examples for validating future skill implementations, not additional architecture requirements.

Scenario Expected behavior
New code introduces a pass-through wrapper without a defensible purpose. Automatic invocation simplifies it within scope and verifies behavior.
New feature touches a legacy function containing an unrelated redundant branch. Record evidence and optionally suggest removal; leave branch unchanged and do not block feature completion.
Manual review finds a simpler implementation of a necessary function. Report alternative and consequences; await human decision.
A seemingly unused method is invoked through framework reflection. Preserve it when the invocation is established; do not classify as dead code.
A single-use interface enforces an intentional architectural boundary. Treat the boundary as justification; do not inline merely because it has one consumer.
An established fallback has uncertain external consumers. Classify as indeterminate; preserve and report uncertainty.
A proposed rewrite reduces line count but obscures intent or changes behavior. Reject the rewrite as unsupported simplification.
Two implementations are equally defensible. Stop; do not create work based solely on preference.

9. Intended outcome

Implementation justification provides a consistent engineering reasoning methodology across agent systems. Preventative invocation reduces the introduction of slop; remedial investigation supports controlled elimination of accumulated slop. Reporting discoveries outside the current task enables continuous technical debt discovery without uncontrolled remediation.

The ultimate measure of success is not how much code an agent deletes, but whether the resulting implementation's existence and complexity are defensible within its actual context.