diff --git a/heudiconv/convert.py b/heudiconv/convert.py
index 73210c1..5d31b19 100644
--- a/heudiconv/convert.py
+++ b/heudiconv/convert.py
@@ -122,13 +122,21 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
     # detected
     # ref: https://github.com/nipy/heudiconv/issues/84#issuecomment-330048609
     # for more automagical wishes
-    target_heuristic_filename = op.join(idir, op.basename(heuristic.filename))
+    target_heuristic_filename = op.join(idir, 'heuristic.py')
+    # faciliates change - TODO: remove in 1.0
+    old_heuristic_filename = op.join(idir, op.basename(heuristic.filename))
+    if op.exists(old_heuristic_filename):
+        assure_no_file_exists(target_heuristic_filename)
+        safe_copyfile(old_heuristic_filename, target_heuristic_filename)
+        assure_no_file_exists(old_heuristic_filename)
     # TODO:
     #  1. add a test
     #  2. possibly extract into a dedicated function for easier logic flow here
     #     and a dedicated unittest
-    if (op.exists(target_heuristic_filename) and
-        file_md5sum(target_heuristic_filename) != file_md5sum(heuristic.filename)):
+    if (
+        op.exists(target_heuristic_filename) and
+        file_md5sum(target_heuristic_filename) != file_md5sum(heuristic.filename)
+    ):
         # remake conversion table
         reuse_conversion_table = False
         lgr.info(
@@ -151,7 +159,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
         # TODO -- might have been done outside already!
         # MG -- will have to try with both dicom template, files
         assure_no_file_exists(target_heuristic_filename)
-        safe_copyfile(heuristic.filename, idir)
+        safe_copyfile(heuristic.filename, target_heuristic_filename)
         if dicoms:
             seqinfo = group_dicoms_into_seqinfos(
                 dicoms,

Cached heuristic name discrepancy
<!-- DO NOT DELETE THIS! 
This template is used to facilitate issue resolution.
All text in <!-> tags will not be displayed.
-->

### Summary
When reconverting and using a different heuristic filename from the cache, the conversion table (`filegroup.json`) is still reused. This results in `heudiconv` ignoring the new heuristic and defaulting to the grouping from the previous heuristic. Relevant code excerpt:

https://github.com/nipy/heudiconv/blob/312cd2e5db4968b1d71920aa681ff2795efc3fab/heudiconv/convert.py#L125-L133
...and saving...
https://github.com/nipy/heudiconv/blob/312cd2e5db4968b1d71920aa681ff2795efc3fab/heudiconv/convert.py#L154

**Proposed solution** - save used heuristic in cache simply as `heuristic.py` to avoid any naming discrepancies.



diff --git a/heudiconv/tests/test_main.py b/heudiconv/tests/test_main.py
index 4656510..7dcd32e 100644
--- a/heudiconv/tests/test_main.py
+++ b/heudiconv/tests/test_main.py
@@ -250,3 +250,22 @@ def test_make_readonly(tmpdir):
         # and it should go back if we set it back to non-read_only
         assert set_readonly(pathname, read_only=False) == rw
         assert not is_readonly(pathname)
+
+
+def test_cache(tmpdir):
+    tmppath = tmpdir.strpath
+    args = (
+        "-f convertall --files %s/axasc35.dcm -s S01"
+        % (TESTS_DATA_PATH)
+    ).split(' ') + ['-o', tmppath]
+    runner(args)
+
+    cachedir = (tmpdir / '.heudiconv' / 'S01' / 'info')
+    assert cachedir.exists()
+
+    # check individual files
+    assert (cachedir / 'heuristic.py').exists()
+    assert (cachedir / 'filegroup.json').exists()
+    assert (cachedir / 'dicominfo.tsv').exists()
+    assert (cachedir / 'S01.auto.txt').exists()
+    assert (cachedir / 'S01.edit.txt').exists()

pip install -e .[all]
parse_log_pytest
requirements.txt
apt-get update apt-get install -y gcc dcm2niix
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
annexremote==1.6.6
appdirs==1.4.4
attrs==22.2.0
boto==2.49.0
certifi==2021.5.30
cffi==1.15.1
chardet==5.0.0
charset-normalizer==2.0.12
ci-info==0.2.0
click==8.0.4
cryptography==40.0.2
datalad==0.15.6
dcmstack==0.9.0
decorator==4.4.2
Deprecated==1.2.18
etelemetry==0.2.2
fasteners==0.19
filelock==3.4.1
-e git+https://github.com/nipy/heudiconv.git@5357359f618a46dba7e4e55febf4e901a59f4523#egg=heudiconv
humanize==3.14.0
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
inotify==0.2.10
iso8601==1.1.0
isodate==0.6.1
jeepney==0.7.1
keyring==23.4.1
keyrings.alt==4.1.0
lxml==5.3.1
mock==5.2.0
msgpack==1.0.5
networkx==2.5.1
nibabel==3.2.2
nipype==1.7.1
nose==1.3.7
numpy==1.19.5
packaging==21.3
pathlib==1.0.1
patool==1.12
pluggy==1.0.0
prov==2.0.1
py==1.11.0
pycparser==2.21
pydicom==2.3.1
pydot==1.4.2
PyGithub==1.56
PyJWT==2.4.0
PyNaCl==1.5.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
python-gitlab==2.10.1
rdflib==5.0.0
requests==2.27.1
requests-toolbelt==1.0.0
scipy==1.5.4
SecretStorage==3.3.3
simplejson==3.20.1
six==1.17.0
swebench-matterhorn @ file:///swebench_matterhorn
tinydb==4.7.0
tomli==1.2.3
tqdm==4.64.1
traits==6.4.1
typing_extensions==4.1.1
urllib3==1.26.20
Whoosh==2.7.4
wrapt==1.16.0
zipp==3.6.0

name: heudiconv
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - annexremote==1.6.6
      - appdirs==1.4.4
      - attrs==22.2.0
      - boto==2.49.0
      - cffi==1.15.1
      - chardet==5.0.0
      - charset-normalizer==2.0.12
      - ci-info==0.2.0
      - click==8.0.4
      - cryptography==40.0.2
      - datalad==0.15.6
      - dcmstack==0.9.0
      - decorator==4.4.2
      - deprecated==1.2.18
      - etelemetry==0.2.2
      - fasteners==0.19
      - filelock==3.4.1
      - humanize==3.14.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - inotify==0.2.10
      - iso8601==1.1.0
      - isodate==0.6.1
      - jeepney==0.7.1
      - keyring==23.4.1
      - keyrings-alt==4.1.0
      - lxml==5.3.1
      - mock==5.2.0
      - msgpack==1.0.5
      - networkx==2.5.1
      - nibabel==3.2.2
      - nipype==1.7.1
      - nose==1.3.7
      - numpy==1.19.5
      - packaging==21.3
      - pathlib==1.0.1
      - patool==1.12
      - pluggy==1.0.0
      - prov==2.0.1
      - py==1.11.0
      - pycparser==2.21
      - pydicom==2.3.1
      - pydot==1.4.2
      - pygithub==1.56
      - pyjwt==2.4.0
      - pynacl==1.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - python-gitlab==2.10.1
      - rdflib==5.0.0
      - requests==2.27.1
      - requests-toolbelt==1.0.0
      - scipy==1.5.4
      - secretstorage==3.3.3
      - simplejson==3.20.1
      - six==1.17.0
      - swebench-matterhorn==0.0.0
      - tinydb==4.7.0
      - tomli==1.2.3
      - tqdm==4.64.1
      - traits==6.4.1
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - whoosh==2.7.4
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/heudiconv

heudiconv/tests/test_main.py::test_cache
heudiconv/tests/test_main.py::test_prepare_for_datalad
heudiconv/tests/test_main.py::test_main_help heudiconv/tests/test_main.py::test_main_version heudiconv/tests/test_main.py::test_create_file_if_missing heudiconv/tests/test_main.py::test_populate_bids_templates heudiconv/tests/test_main.py::test_add_participant_record heudiconv/tests/test_main.py::test_get_formatted_scans_key_row heudiconv/tests/test_main.py::test_add_rows_to_scans_keys_file heudiconv/tests/test_main.py::test__find_subj_ses heudiconv/tests/test_main.py::test_make_readonly
heudiconv/convert.py
heudiconv/convert.py